Skip to content

Commit 4a5f4aa

Browse files
committed
Add reply Alias.
1 parent e4dd155 commit 4a5f4aa

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

discord_slash/context.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,64 @@ async def send(
272272
else:
273273
return resp
274274

275+
async def reply(
276+
self,
277+
content: str = "",
278+
*,
279+
embed: discord.Embed = None,
280+
embeds: typing.List[discord.Embed] = None,
281+
tts: bool = False,
282+
file: discord.File = None,
283+
files: typing.List[discord.File] = None,
284+
allowed_mentions: discord.AllowedMentions = None,
285+
hidden: bool = False,
286+
delete_after: float = None,
287+
components: typing.List[dict] = None,
288+
) -> model.SlashMessage:
289+
"""
290+
Sends response of the interaction. This is currently an alias of the ``.send()`` method.
291+
292+
.. warning::
293+
- Since Release 1.0.9, this is completely changed. If you are migrating from older version, please make sure to fix the usage.
294+
- You can't use both ``embed`` and ``embeds`` at the same time, also applies to ``file`` and ``files``.
295+
- If you send files in the initial response, this will defer if it's not been deferred, and then PATCH with the message
296+
297+
:param content: Content of the response.
298+
:type content: str
299+
:param embed: Embed of the response.
300+
:type embed: discord.Embed
301+
:param embeds: Embeds of the response. Maximum 10.
302+
:type embeds: List[discord.Embed]
303+
:param tts: Whether to speak message using tts. Default ``False``.
304+
:type tts: bool
305+
:param file: File to send.
306+
:type file: discord.File
307+
:param files: Files to send.
308+
:type files: List[discord.File]
309+
:param allowed_mentions: AllowedMentions of the message.
310+
:type allowed_mentions: discord.AllowedMentions
311+
:param hidden: Whether the message is hidden, which means message content will only be seen to the author.
312+
:type hidden: bool
313+
:param delete_after: If provided, the number of seconds to wait in the background before deleting the message we just sent. If the deletion fails, then it is silently ignored.
314+
:type delete_after: float
315+
:param components: Message components in the response. The top level must be made of ActionRows.
316+
:type components: List[dict]
317+
:return: Union[discord.Message, dict]
318+
"""
319+
320+
return await self.send(
321+
content=content,
322+
embed=embed,
323+
embeds=embeds,
324+
tts=tts,
325+
file=file,
326+
files=files,
327+
allowed_mentions=allowed_mentions,
328+
hidden=hidden,
329+
delete_after=delete_after,
330+
components=components,
331+
)
332+
275333

276334
class SlashContext(InteractionContext):
277335
"""

0 commit comments

Comments
 (0)