aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Izan <[email protected]>2022-09-17 19:24:37 +0100
committerGravatar Izan <[email protected]>2022-09-17 19:24:37 +0100
commit11f369307cf4423458c7ce60aeda7637f35bef8e (patch)
tree0655e41f8308b8bf9896720532bfa86d93858cd8
parentDisplay mentions instead of name attribute in `!reminder list` (diff)
Address Review
- Convert `ids` to a set to remove duplicates - Limit the amount of reminders you can delete at once to 5 in order to prevent API spam
-rw-r--r--bot/exts/utils/reminders.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bot/exts/utils/reminders.py b/bot/exts/utils/reminders.py
index 51fdd7873..4f7e1c255 100644
--- a/bot/exts/utils/reminders.py
+++ b/bot/exts/utils/reminders.py
@@ -465,9 +465,13 @@ class Reminders(Cog):
@remind_group.command("delete", aliases=("remove", "cancel"))
async def delete_reminder(self, ctx: Context, ids: Greedy[int]) -> None:
- """Delete one of your active reminders."""
+ """Delete up to (and including) 5 of your active reminders."""
+ if len(ids) > 5:
+ await send_denial(ctx, "You can only delete a maximum of 5 reminders at once.")
+ return
+
deleted_ids = []
- for id_ in ids:
+ for id_ in set(ids):
try:
reminder_deleted = await self._delete_reminder(ctx, id_)
except LockedResourceError: