-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix reference messages not being fully deleted #910
Conversation
04d24b2
to
9560ff5
Compare
referenced_message = message.object.referenced_message | ||
if not referenced_message and message.object.message_reference and message.object.message_reference.id: | ||
msg_id = message.object.message_reference.id | ||
referenced_message = self._message_entries.get(msg_id) or self._referenced_messages.get(msg_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this actually fixes the issue, if a referenced message is cached when message.referenced_message is None then wouldn't that infer there's a case the update/set logic isn't accounting for (possibly to do with idk something funky like the referenced message being deleted and that not cascading to places where its being referenced (to give a random example)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware if there are any other cases, but another way that I could think of to handle this particular case is to ensure that we're not overriding referenced_message's referenced_message since Discord gives us None.
if not referenced_message and message.object.message_reference and message.object.message_reference.id: | ||
msg_id = message.object.message_reference.id | ||
referenced_message = self._message_entries.get(msg_id) or self._referenced_messages.get(msg_id) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also you're not accounting for what kind of reference this is so for stuff like cross posts, channel follows, and pins adds where you'd have message_reference.id but not referenced_message so this could lead to other edge case bugs but i'm not bothered to check how this'd play out in those scenarios rn
Closed to let @norinorin re-open with their changes |
Pull request was closed
Thanks to @norinorin for finding the bug and providing the patch!
The patch was submitted with explicit permission from them
Checklist
nox
and all the pipelines have passed.Related issues
Closes #904