1
Fork 0
mirror of https://github.com/allthingslinux/tux.git synced 2024-10-02 16:43:12 +00:00
tux/.archive/on_message.py

29 lines
720 B
Python

# on_message.py
import discord
from discord.ext import commands
from tux.utils.tux_logger import TuxLogger
logger = TuxLogger(__name__)
class OnMessage(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
"""This event is triggered whenever a message is sent in a channel.
Args:
message (discord.Message): Represents a Discord message.
""" # noqa E501
if message.author == self.bot.user:
return
if message.content.startswith("!hello"):
await message.channel.send("Hello!")
async def setup(bot):
await bot.add_cog(OnMessage(bot))