Small set of hotfixes to make blocked_tids behave properly (#46)

* Revert log.exception() call to working state

* Await add_roles call and invoke warn command correctly

* Apply black formatting
This commit is contained in:
TSRBerry 2023-05-01 21:02:37 +02:00 committed by GitHub
parent 5be9915501
commit 2506aa6437
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 6 deletions

View file

@ -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)

View file

@ -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 ⛔",