From ff54d3988837c8ebb7c75aba0c738b91feaea02f Mon Sep 17 00:00:00 2001 From: AstreaTSS <25420078+AstreaTSS@users.noreply.github.com> Date: Wed, 21 Feb 2024 00:05:15 -0500 Subject: [PATCH 1/2] feat: add toggle for fail_if_not_exists for PrefixedContext.reply --- interactions/ext/prefixed_commands/context.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/interactions/ext/prefixed_commands/context.py b/interactions/ext/prefixed_commands/context.py index ff6177491..3c38011f0 100644 --- a/interactions/ext/prefixed_commands/context.py +++ b/interactions/ext/prefixed_commands/context.py @@ -7,7 +7,7 @@ from interactions.models.discord.channel import TYPE_MESSAGEABLE_CHANNEL from interactions.models.discord.embed import Embed from interactions.models.discord.file import UPLOADABLE_TYPE -from interactions.models.discord.message import Message +from interactions.models.discord.message import Message, MessageReference from interactions.models.internal.context import BaseContext from interactions.models.misc.context_manager import Typing @@ -86,6 +86,7 @@ async def reply( content: Optional[str] = None, embeds: Optional[Union[Iterable[Union[Embed, dict]], Union[Embed, dict]]] = None, embed: Optional[Union[Embed, dict]] = None, + fail_if_not_exists: bool = True, **kwargs: Any, ) -> Message: """ @@ -95,10 +96,12 @@ async def reply( content: Message text content. embeds: Embedded rich content (up to 6000 characters). embed: Embedded rich content (up to 6000 characters). + fail_if_not_exists: Whether to error if the command invocation doesn't exist. **kwargs: Additional options to pass to `send`. Returns: New message object. """ - return await self.send(content=content, reply_to=self.message, embeds=embeds or embed, **kwargs) + ref = MessageReference.for_message(self.message, fail_if_not_exists=fail_if_not_exists) + return await self.send(content=content, reply_to=ref, embeds=embeds or embed, **kwargs) From 6085283770b9fb4d8959d80b27bf194a2c28c136 Mon Sep 17 00:00:00 2001 From: AstreaTSS <25420078+AstreaTSS@users.noreply.github.com> Date: Wed, 21 Feb 2024 00:11:23 -0500 Subject: [PATCH 2/2] docs: parity with other fail_if_not_exists --- interactions/ext/prefixed_commands/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interactions/ext/prefixed_commands/context.py b/interactions/ext/prefixed_commands/context.py index 3c38011f0..a9d995faf 100644 --- a/interactions/ext/prefixed_commands/context.py +++ b/interactions/ext/prefixed_commands/context.py @@ -96,7 +96,7 @@ async def reply( content: Message text content. embeds: Embedded rich content (up to 6000 characters). embed: Embedded rich content (up to 6000 characters). - fail_if_not_exists: Whether to error if the command invocation doesn't exist. + fail_if_not_exists: Whether to error if the command invocation doesn't exist instead of sending as a normal (non-reply) message. **kwargs: Additional options to pass to `send`. Returns: