mirror of
https://github.com/polyjitter/searchbot-discord.git
synced 2024-08-14 22:46:55 +00:00
Added command call logging
This commit is contained in:
parent
6d3666fe18
commit
7e803a87e9
1 changed files with 15 additions and 0 deletions
|
@ -27,6 +27,8 @@ class BetterLogging(commands.Cog):
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_guild_join(self, guild):
|
async def on_guild_join(self, guild):
|
||||||
|
"""Logs guild joining."""
|
||||||
|
|
||||||
msg = f"\U0001F4C8 **Joined {guild.name}**\n\n"
|
msg = f"\U0001F4C8 **Joined {guild.name}**\n\n"
|
||||||
msg += f"_Owner:_ {guild.owner}\n"
|
msg += f"_Owner:_ {guild.owner}\n"
|
||||||
msg += f"_Member Count:_ {guild.member_count}\n\n"
|
msg += f"_Member Count:_ {guild.member_count}\n\n"
|
||||||
|
@ -36,6 +38,8 @@ class BetterLogging(commands.Cog):
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_guild_remove(self, guild):
|
async def on_guild_remove(self, guild):
|
||||||
|
"""Logs guild leaving."""
|
||||||
|
|
||||||
msg = f"**\U0001F4C9 Left {guild.name}**\n\n"
|
msg = f"**\U0001F4C9 Left {guild.name}**\n\n"
|
||||||
msg += f"_Owner:_ {guild.owner}\n"
|
msg += f"_Owner:_ {guild.owner}\n"
|
||||||
msg += f"_Member Count:_ {guild.member_count}\n\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")
|
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):
|
async def cog_check(self, ctx):
|
||||||
return commands.is_owner()(ctx.command)
|
return commands.is_owner()(ctx.command)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue