Fix false error message when deleting reminders with duplicate IDs#3500
Fix false error message when deleting reminders with duplicate IDs#3500oliveman-au wants to merge 1 commit intopython-discord:mainfrom
Conversation
lemonsaurus
left a comment
There was a problem hiding this comment.
one-liner fix, code looks good, you've proven it's a real bug, even added a screenshot of the bug being reproduced - nice! Good PR. Thanks for the contribution! 👍🏼
jb3
left a comment
There was a problem hiding this comment.
We should reuse the already created set from earlier in the command, that's going to be a cleaner solution here and avoids a set creation twice for the same list (and solves other issues like how passing the same reminder ID in would go above the 5 reminder limit, even if it's the same reminder).
I suggest instead you do the set conversion earlier in the command (pretty much the first thing) and replace subsequent set(ids) invocations with that.
|
Should be combined into one PR across all reminder functionality. Also please see my review comment. |

When running
!remind deletewith duplicate IDs (e.g.!remind delete 123 123 123), the reminder is deleted successfully but the bot incorrectly shows "The other reminder(s) could not be deleted as they're either locked, belong to someone else, or don't exist."This happens because the check compares
len(deleted_ids)againstlen(ids), but the loop iterates overset(ids)to deduplicate. So passing 3 identical IDs results in 1 deletion butlen(ids)is still 3, making it look like 2 failed.Fixed by comparing against
len(set(ids))instead, which matches what was actually attempted.