made none mean dms in logging

This commit is contained in:
Adriene Hutchins 2020-03-03 19:48:40 -05:00
parent 47ea949d52
commit 1db31f55a9
2 changed files with 11 additions and 3 deletions

View File

@ -53,7 +53,7 @@ class BetterLogging(commands.Cog):
msg = (
f"**`{ctx.command.name}`** called by "
f"**{ctx.author}** in _\"{ctx.guild}\"_."
f"**{ctx.author}** in _\"{ctx.guild if ctx.guild else 'DMs'}\"_."
)
await self.info(content=msg, name="Command Call")

12
main.py
View File

@ -198,14 +198,22 @@ async def on_command_error(ctx, error):
# Prerequisites
embed_fallback = f"**An error occured: {type(error).__name__}. Please contact {bot.appinfo.owner}.**"
error_embed = await bot.logging.error(error, ctx, ctx.command.cog.qualified_name)
error_embed = await bot.logging.error(
error, ctx,
ctx.command.cog.qualified_name if ctx.command.cog.qualified_name
else "DMs"
)
# Sending
await ctx.send(embed_fallback, embed=error_embed)
# If anything else goes wrong, just go ahead and send it in chat.
else:
await bot.logging.error(error, ctx, ctx.command.cog.qualified_name)
await bot.logging.error(
error, ctx,
ctx.command.cog.qualified_name if ctx.command.cog.qualified_name
else "DMs"
)
await ctx.send(error)
# NOTE Bot Entry Point
# Starts the bot