From 1443dce3566baf2733d8b7dfc2c182e31220a270 Mon Sep 17 00:00:00 2001 From: Myned Date: Fri, 20 Oct 2017 16:17:55 -0400 Subject: [PATCH] on_message override to check if invoker is bot --- src/main/run.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/run.py b/src/main/run.py index 0ce49f3..6d46849 100644 --- a/src/main/run.py +++ b/src/main/run.py @@ -55,15 +55,23 @@ async def on_ready(): u.temp.clear() +@bot.event +async def on_message(message): + if message.author.bot or message.author is bot.user: + return + + await bot.process_commands(message) + + @bot.event async def on_error(error, *args, **kwargs): - print('\n! ! ! ! !\nE R R O R : {}\n! ! ! ! !\n'.format(error), file=sys.stderr) - tb.print_exc() + print('\n! ! ! ! !\nE R R O R : {}\n! ! ! ! !\n'.format(error), file=sys.stderr) + tb.print_exc() await bot.get_user(u.config['owner_id']).send('**ERROR** ⚠ `{}`'.format(error)) await bot.get_channel(u.config['info_channel']).send('**ERROR** ⚠ `{}`'.format(error)) - # u.notify('E R R O R') - await bot.logout() - u.close(bot.loop) + # u.notify('E R R O R') + await bot.logout() + u.close(bot.loop) @bot.event