Move command logging to on_command

pull/8/head
Stijn De Clercq 2020-11-03 16:09:22 +01:00
parent c897cebcd5
commit 08b5742830
1 changed files with 13 additions and 9 deletions

View File

@ -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):
"""