diff options
Diffstat (limited to 'bot/seasons/halloween/spookyreact.py')
| -rw-r--r-- | bot/seasons/halloween/spookyreact.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bot/seasons/halloween/spookyreact.py b/bot/seasons/halloween/spookyreact.py index f63cd7e5..9b14507a 100644 --- a/bot/seasons/halloween/spookyreact.py +++ b/bot/seasons/halloween/spookyreact.py @@ -2,6 +2,7 @@ import logging import re import discord +from discord.ext.commands import Cog log = logging.getLogger(__name__) @@ -16,23 +17,22 @@ SPOOKY_TRIGGERS = { } -class SpookyReact: - - """ - A cog that makes the bot react to message triggers. - """ +class SpookyReact(Cog): + """A cog that makes the bot react to message triggers.""" def __init__(self, bot): self.bot = bot + @Cog.listener() async def on_message(self, ctx: discord.Message): """ - A command to send the seasonalbot github project + A command to send the seasonalbot github project. Lines that begin with the bot's command prefix are ignored Seasonalbot's own messages are ignored """ + for trigger in SPOOKY_TRIGGERS.keys(): trigger_test = re.search(SPOOKY_TRIGGERS[trigger][0], ctx.content.lower()) if trigger_test: @@ -52,6 +52,7 @@ class SpookyReact: * author is the bot * prefix is not None """ + # Check for self reaction if ctx.author == self.bot.user: logging.debug(f"Ignoring reactions on self message. Message ID: {ctx.id}") @@ -68,5 +69,7 @@ class SpookyReact: def setup(bot): + """Spooky reaction Cog load.""" + bot.add_cog(SpookyReact(bot)) - log.debug("SpookyReact cog loaded") + log.info("SpookyReact cog loaded") |