diff --git a/robocop_ng/__main__.py b/robocop_ng/__main__.py index bc9fdd4..796cc2c 100755 --- a/robocop_ng/__main__.py +++ b/robocop_ng/__main__.py @@ -148,7 +148,7 @@ async def on_command_error(ctx: Context, error: CommandError): f"of type {type(error)}: {error_text}" ) - log.exception(err_msg, error) + log.exception(err_msg) if not isinstance(error, commands.CommandNotFound): err_msg = bot.escape_message(err_msg) diff --git a/robocop_ng/cogs/logfilereader.py b/robocop_ng/cogs/logfilereader.py index 12bbceb..f755e8b 100644 --- a/robocop_ng/cogs/logfilereader.py +++ b/robocop_ng/cogs/logfilereader.py @@ -722,13 +722,22 @@ class LogFileReader(Cog): pass if is_tid_blocked(): - warn_message = await message.reply( - f".warn This log contains a blocked title id." - ) - await self.bot.invoke(await self.bot.get_context(warn_message)) + warn_command = self.bot.get_command("warn") + if warn_command is not None: + warn_message = await message.reply( + ".warn This log contains a blocked title id." + ) + warn_context = await self.bot.get_context(warn_message) + await warn_context.invoke( + warn_command, reason="This log contains a blocked title id." + ) + else: + logging.error( + f"Couldn't find 'warn' command. Unable to warn {message.author}." + ) pirate_role = message.guild.get_role(self.bot.config.named_roles["pirate"]) - message.author.add_roles(pirate_role) + await message.author.add_roles(pirate_role) embed = Embed( title="⛔ Blocked game detected ⛔",