From 5604746e4f945ad151cd07991df2b07852ecbaff Mon Sep 17 00:00:00 2001 From: sgoudham Date: Fri, 4 Sep 2020 13:27:49 +0100 Subject: [PATCH] Stopped messages from displaying twice --- cogs/events.py | 11 ----------- main.py | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cogs/events.py b/cogs/events.py index 46312882..f5b3e31e 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -11,17 +11,6 @@ class Events(Cog): def __init__(self, bot): self.bot = bot - @Cog.listener() - async def on_message(self, message): - """Make sure bot messages are not tracked""" - - # Ignoring messages that start with 2 .. - if message.content.startswith("..") or message.author.bot: - return - - # Processing the message - await self.bot.process_commands(message) - @Cog.listener() async def on_ready(self): """Display startup message""" diff --git a/main.py b/main.py index cc540415..1909845b 100644 --- a/main.py +++ b/main.py @@ -20,5 +20,18 @@ from bot import Bot # Initiating Bot Object As Client client = Bot() + +@client.event +async def on_message(message): + """Make sure bot messages are not tracked""" + + # Ignoring messages that start with 2 .. + if message.content.startswith("..") or message.author.bot: + return + + # Processing the message + await client.process_commands(message) + + # Run the bot client.execute()