fix: handle Forbidden when sending confirm-thread-creation DM (#3442)#3447
Open
13-Prabhat wants to merge 4 commits into
Open
fix: handle Forbidden when sending confirm-thread-creation DM (#3442)#344713-Prabhat wants to merge 4 commits into
13-Prabhat wants to merge 4 commits into
Conversation
Replaces the claim plugin by fourjr to my claim plugin due to being fundamentally broken as of the current time. It has been created few support issues already that were not successfull to use the plugin.
Member
|
Hi, it looks like you are trying to merge this into the master branch. Can you change this into the development branch? Thanks for the PR tho! |
Author
|
Hi! I've opened a PR for this issue and implemented a fix for the thread cleanup path when DM delivery fails. Please have a look when convenient. Feedback is welcome. Thanks! |
Author
|
Thanks for pointing that out. I've updated the PR to target the Please let me know if there's anything else that needs to be adjusted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3442
Bug
When both
react to contactandconfirm_thread_creationare enabled, and the recipient has DMs disabled, the confirmation prompt sent fromThreadManager.create()can raise an uncaughtdiscord.Forbiddenexception.Because the exception occurs before
view.wait()is reached, the thread remains cached in a "not ready" state and never gets cleaned up. As a result, subsequent contact attempts may report that a thread already exists, and the stale state persists until the bot is restarted.Fix
Added a
try/except discord.Forbiddenblock around the confirmation promptsend()call.If the DM cannot be delivered, the code now:
This mirrors the existing cleanup logic already used for the deny and timeout paths below.
Testing
python -m py_compileblackThe repository does not currently include an automated test suite, so validation was performed through code review and manual tracing of the execution flow.