Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions bot/exts/utils/reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@ async def try_get_content_from_reply(ctx: Context) -> str:
# If the replied message has no content, we couldn't get the content, or no content was provided
# (e.g. only attachments/embeds)
if content is None or content == "":
content = "*See referenced message.*"
await ctx.send("The referenced message has no content, please provide content directly.")
return None

return content

Expand Down Expand Up @@ -492,6 +493,8 @@ async def new_reminder(
# If `content` isn't provided then we try to get message content of a replied message
if not content:
content = await self.try_get_content_from_reply(ctx)
if content is None:
return

# Now we can attempt to actually set the reminder.
reminder = await self.bot.api_client.post(
Expand Down Expand Up @@ -600,6 +603,10 @@ async def edit_reminder_duration(self, ctx: Context, id_: int, expiration: Durat

For example, to edit a reminder to expire in 3 days and 1 minute, you can do `!remind edit duration 1234 3d1M`.
"""
if expiration < datetime.now(UTC):
await send_denial(ctx, "Your reminder duration must be in the future!")
return

formatted_time = time.discord_timestamp(expiration, time.TimestampFormats.DAY_TIME)
message = f"It will arrive on {formatted_time}."

Expand All @@ -614,6 +621,8 @@ async def edit_reminder_content(self, ctx: Context, id_: int, *, content: str |
"""
if not content:
content = await self.try_get_content_from_reply(ctx)
if content is None:
return

await self.edit_reminder(ctx, id_, {"content": content})

Expand Down Expand Up @@ -678,7 +687,7 @@ async def delete_reminder(self, ctx: Context, ids: Greedy[int]) -> None:
title = random.choice(POSITIVE_REPLIES)
deletion_message = f"Successfully deleted the following reminder(s): {', '.join(deleted_ids)}"

if len(deleted_ids) != len(ids):
if len(deleted_ids) != len(set(ids)):
deletion_message += (
"\n\nThe other reminder(s) could not be deleted as they're either locked, "
"belong to someone else, or don't exist."
Expand Down