aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2022-11-26 14:28:18 +0400
committerGravatar Hassan Abouelela <[email protected]>2022-11-26 14:28:18 +0400
commit81a68784559d231afcc055c2d34cb71314d5bd61 (patch)
tree9261abdafdfff653562058179937b83188f02869
parentDon't Remove Cooldown Role From Non-Existing Users (diff)
Catch Failure In Pining Help Starter Message
The old method for detecting deleted opener messages does not seem to work, probably because the message is fetched from a cache or similar. Instead we simply try/except pinning the message and pass if the pinning failed. Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r--bot/exts/help_channels/_channel.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py
index a41fcd63f..04c2cc454 100644
--- a/bot/exts/help_channels/_channel.py
+++ b/bot/exts/help_channels/_channel.py
@@ -125,9 +125,14 @@ async def help_thread_opened(opened_thread: discord.Thread, *, reopen: bool = Fa
await send_opened_post_dm(opened_thread)
- if opened_thread.starter_message:
- # To cover the case where the user deletes their starter message before code execution reaches this line.
+ try:
await opened_thread.starter_message.pin()
+ except discord.HTTPException as e:
+ if e.code == 10008:
+ # The message was not found, most likely deleted
+ pass
+ else:
+ raise e
await send_opened_post_message(opened_thread)