Added command call logging

This commit is contained in:
Adriene Hutchins 2020-03-03 19:42:35 -05:00
parent 6d3666fe18
commit 7e803a87e9
1 changed files with 15 additions and 0 deletions

View File

@ -27,6 +27,8 @@ class BetterLogging(commands.Cog):
@commands.Cog.listener()
async def on_guild_join(self, guild):
"""Logs guild joining."""
msg = f"\U0001F4C8 **Joined {guild.name}**\n\n"
msg += f"_Owner:_ {guild.owner}\n"
msg += f"_Member Count:_ {guild.member_count}\n\n"
@ -36,6 +38,8 @@ class BetterLogging(commands.Cog):
@commands.Cog.listener()
async def on_guild_remove(self, guild):
"""Logs guild leaving."""
msg = f"**\U0001F4C9 Left {guild.name}**\n\n"
msg += f"_Owner:_ {guild.owner}\n"
msg += f"_Member Count:_ {guild.member_count}\n\n"
@ -43,6 +47,17 @@ class BetterLogging(commands.Cog):
await self.info(content=msg, name="Guild Leave")
@commands.Cog.listener()
async def on_command(self, ctx):
"""Logs command calls."""
msg = (
f"**`{ctx.command.name}`** called by "
f"**{ctx.author}** in _\"{ctx.guild}\"_."
)
await self.info(context=msg, name="Command Call")
async def cog_check(self, ctx):
return commands.is_owner()(ctx.command)