From 1db31f55a93da031a34df0dc3154424c3f76ddff Mon Sep 17 00:00:00 2001 From: Adriene Hutchins Date: Tue, 3 Mar 2020 19:48:40 -0500 Subject: [PATCH] made none mean dms in logging --- extensions/betterlogging.py | 2 +- main.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/extensions/betterlogging.py b/extensions/betterlogging.py index fa042f1..f258223 100644 --- a/extensions/betterlogging.py +++ b/extensions/betterlogging.py @@ -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") diff --git a/main.py b/main.py index 5d2cde1..4006157 100644 --- a/main.py +++ b/main.py @@ -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