Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exception handling to role reminder message #226

Merged
merged 13 commits into from
May 26, 2024
10 changes: 5 additions & 5 deletions cogs/induct.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ async def _perform_induction(self, ctx: TeXBotApplicationContext, induction_memb
await recent_message.add_reaction(tex_emoji)
await recent_message.add_reaction("👋")
except discord.Forbidden as forbidden_error:
if "90001" in str(forbidden_error):
logger.info(
if "90001" not in str(forbidden_error):
raise forbidden_error from forbidden_error

logger.info(
"Failed to add reactions because the user, %s, "
MattyTheHacker marked this conversation as resolved.
Show resolved Hide resolved
"has blocked the bot.",
recent_message.author,
)
else:
raise forbidden_error from forbidden_error
)
break

await initial_response.edit(content=":white_check_mark: User inducted successfully.")
Expand Down
2 changes: 1 addition & 1 deletion cogs/send_get_roles_reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async def send_get_roles_reminders(self) -> None:
"and year group identifiers.",
)
except discord.Forbidden:
CarrotManMatt marked this conversation as resolved.
Show resolved Hide resolved
logger.warning(
logger.info(
"Failed to open DM channel to user, %s, so no role reminder was sent.",
member,
)
Expand Down