From 08b574283003d4fbfb4e06d275cad80594409939 Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Tue, 3 Nov 2020 16:09:22 +0100 Subject: [PATCH] Move command logging to on_command --- cogs/events.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/cogs/events.py b/cogs/events.py index aa4979b..e9ca378 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -66,16 +66,8 @@ class Events(commands.Cog): if not checks.freeGamesCheck(message): await self.failedChecksCog.freeGames(message) - # Log commands in terminal - # TODO move to on_command - # if any(message.content.lower().startswith(pre) for pre in self.client.prefixes): - # DM = message.guild is None - # print("{} in {}: {}".format(message.author.display_name, - # "DM" if DM else "{} ({})".format(message.channel.name, message.guild.name), - # message.content)) - # Boos React to people that call him Dider - if "dider" in message.content.lower() and str(message.author.id) not in [constants.myId, constants.didierId]: + if "dider" in message.content.lower() and str(message.author.id) not in [constants.myId, constants.didierId, constants.coolerDidierId]: await message.add_reaction("<:boos:629603785840263179>") # Check for other easter eggs @@ -86,6 +78,18 @@ class Events(commands.Cog): # Earn XP & Message count stats.sentMessage(message) + @commands.Cog.listener() + async def on_command(self, ctx): + """ + Function called whenever someone invokes a command. + Logs commands in your terminal. + :param ctx: Discord Context + """ + DM = ctx.guild is None + print("{} in {}: {}".format(ctx.author.display_name, + "DM" if DM else "{} ({})".format(ctx.channel.name, ctx.guild.name), + ctx.message.content)) + @commands.Cog.listener() async def on_command_error(self, ctx, err): """