Skip to content

Commit

Permalink
Await add_roles call and invoke warn command correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
TSRBerry committed May 1, 2023
1 parent 2d534a0 commit 63439e8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions robocop_ng/cogs/logfilereader.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,13 +722,16 @@ def severity(log_note_string):
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 ⛔",
Expand Down

0 comments on commit 63439e8

Please sign in to comment.