aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-11-26 16:37:15 +0000
committerGravatar Chris Lovering <[email protected]>2022-11-26 17:38:58 +0000
commite0086aa61d2d9d1c210a2a775dabaffa95c5b552 (patch)
tree7d0cc868781aea5c569546b7193ba3bd8db9ecc8
parentUpdate CODEOWNERS (diff)
Catch case where starter message is deleted before pinning
-rw-r--r--bot/exts/help_channels/_channel.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py
index ffdd1d2bf..25a1bf4d2 100644
--- a/bot/exts/help_channels/_channel.py
+++ b/bot/exts/help_channels/_channel.py
@@ -127,9 +127,11 @@ async def help_post_opened(opened_post: discord.Thread, *, reopen: bool = False)
try:
await opened_post.starter_message.pin()
- except discord.HTTPException as e:
+ except (discord.HTTPException, AttributeError) as e:
# Suppress if the message was not found, most likely deleted
- if e.code != 10008:
+ # The message being deleted could be surfaced as an AttributeError on .starter_message,
+ # or as an exception from the Discord API, depending on timing and cache status.
+ if isinstance(e, discord.HTTPException) and e.code != 10008:
raise e
await send_opened_post_message(opened_post)