aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2025-02-16 13:39:37 +0000
committerGravatar GitHub <[email protected]>2025-02-16 13:39:37 +0000
commit3964baaac93ed4f009032aac04c34d8b75597d41 (patch)
tree269dfed6b81db0b4814e665b5727428bfa58d9b6
parentSend purged msg log to #message-change-log too (#3255) (diff)
parentClean up extraneous logic and typing variance now that reminders always have ... (diff)
Merge pull request #3259 from bast0006/bast0006-textless-remindme
Permit !remindme with no specified content
-rw-r--r--bot/exts/utils/reminders.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/bot/exts/utils/reminders.py b/bot/exts/utils/reminders.py
index c79e0499c..ccc5ac75a 100644
--- a/bot/exts/utils/reminders.py
+++ b/bot/exts/utils/reminders.py
@@ -252,9 +252,9 @@ class Reminders(Cog):
await self.bot.api_client.delete(f"bot/reminders/{reminder['id']}")
@staticmethod
- async def try_get_content_from_reply(ctx: Context) -> str | None:
+ async def try_get_content_from_reply(ctx: Context) -> str:
"""
- Attempts to get content from the referenced message, if applicable.
+ Attempts to get content from the referenced message, if applicable, or provides a default.
Differs from pydis_core.utils.commands.clean_text_or_reply as allows for messages with no content.
"""
@@ -263,13 +263,9 @@ class Reminders(Cog):
if isinstance((resolved_message := reference.resolved), discord.Message):
content = resolved_message.content
- # If we weren't able to get the content of a replied message
- if content is None:
- await send_denial(ctx, "Your reminder must have a content and/or reply to a message.")
- return None
-
- # If the replied message has no content (e.g. only attachments/embeds)
- if content == "":
+ # 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.*"
return content
@@ -349,9 +345,6 @@ class Reminders(Cog):
# 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 not content:
- # Couldn't get content from reply
- return
# Now we can attempt to actually set the reminder.
reminder = await self.bot.api_client.post(
@@ -473,9 +466,7 @@ class Reminders(Cog):
"""
if not content:
content = await self.try_get_content_from_reply(ctx)
- if not content:
- # Message doesn't have a reply to get content from
- return
+
await self.edit_reminder(ctx, id_, {"content": content})
@edit_reminder_group.command(name="mentions", aliases=("pings",))