Skip to content

Commit

Permalink
Add Interaction.followup method
Browse files Browse the repository at this point in the history
  • Loading branch information
4Kaylum committed Feb 8, 2024
1 parent 623118b commit 0e0602a
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions novus/models/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,80 @@ async def send(
)
return

async def followup(
self: Interaction,
content: str = MISSING,
*,
tts: bool = MISSING,
embeds: list[Embed] = MISSING,
allowed_mentions: AllowedMentions = MISSING,
components: list[ActionRow] = MISSING,
message_reference: Message = MISSING,
stickers: list[Sticker] = MISSING,
files: list[File] = MISSING,
flags: MessageFlags = MISSING,
ephemeral: bool = False) -> Message:
"""
Send a message associated with the interaction response.
Parameters
----------
content : str
The content that you want to have in the message
tts : bool
If you want the message to be sent with the TTS flag.
embeds : list[novus.Embed]
The embeds you want added to the message.
allowed_mentions : novus.AllowedMentions
The mentions you want parsed in the message.
components : list[novus.ActionRow]
A list of action rows to be added to the message.
message_reference : novus.Message
A reference to a message you want replied to.
stickers : list[novus.Sticker]
A list of stickers to add to the message.
files : list[novus.File]
A list of files to be sent with the message.
flags : novus.MessageFlags
The flags to be sent with the message.
ephemeral : bool
Whether the message should be sent so only the calling user can see
it.
This is ignored if this is the first message you're sending
relating to this interaction and you've previously deferred.
"""

data: dict[str, Any] = {}

if content is not MISSING:
data["content"] = content
if tts is not MISSING:
data["tts"] = tts
if embeds is not MISSING:
data["embeds"] = embeds
if allowed_mentions is not MISSING:
data["allowed_mentions"] = allowed_mentions
if components is not MISSING:
data["components"] = components
if message_reference is not MISSING:
data["message_reference"] = message_reference
if stickers is not MISSING:
data["stickers"] = stickers
if files is not MISSING:
data["files"] = files
if flags is MISSING:
data["flags"] = MessageFlags()
else:
data["flags"] = flags
if ephemeral:
data["flags"].ephemeral = True

return await self.state.interaction.create_followup_message(
self.application_id,
self.token,
**data,
)

async def defer(self: Interaction, *, ephemeral: bool = False) -> None:
"""
Send a defer response.
Expand Down

0 comments on commit 0e0602a

Please sign in to comment.