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:
parent
5be9915501
commit
2506aa6437
2 changed files with 15 additions and 6 deletions
|
@ -148,7 +148,7 @@ async def on_command_error(ctx: Context, error: CommandError):
|
||||||
f"of type {type(error)}: {error_text}"
|
f"of type {type(error)}: {error_text}"
|
||||||
)
|
)
|
||||||
|
|
||||||
log.exception(err_msg, error)
|
log.exception(err_msg)
|
||||||
|
|
||||||
if not isinstance(error, commands.CommandNotFound):
|
if not isinstance(error, commands.CommandNotFound):
|
||||||
err_msg = bot.escape_message(err_msg)
|
err_msg = bot.escape_message(err_msg)
|
||||||
|
|
|
@ -722,13 +722,22 @@ class LogFileReader(Cog):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if is_tid_blocked():
|
if is_tid_blocked():
|
||||||
warn_message = await message.reply(
|
warn_command = self.bot.get_command("warn")
|
||||||
f".warn This log contains a blocked title id."
|
if warn_command is not None:
|
||||||
)
|
warn_message = await message.reply(
|
||||||
await self.bot.invoke(await self.bot.get_context(warn_message))
|
".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"])
|
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(
|
embed = Embed(
|
||||||
title="⛔ Blocked game detected ⛔",
|
title="⛔ Blocked game detected ⛔",
|
||||||
|
|
Loading…
Reference in a new issue