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

30 lines
720 B
Python
Raw Normal View History

2024-01-09 01:27:09 +00:00
# on_message.py
import discord
from discord.ext import commands
2024-01-09 02:01:17 +00:00
2024-01-09 01:27:09 +00:00
from tux.utils.tux_logger import TuxLogger
logger = TuxLogger(__name__)
2023-12-30 07:28:25 +00:00
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
2023-12-29 15:28:47 +00:00
if message.content.startswith("!hello"):
await message.channel.send("Hello!")
async def setup(bot):
2023-12-30 07:28:25 +00:00
await bot.add_cog(OnMessage(bot))