Skip to content

Commit c57c1f1

Browse files
committed
Added hidden support
1 parent 128dbae commit c57c1f1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

discord_slash/model.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ async def send(self,
4141
content: str = "",
4242
embeds: typing.List[discord.Embed] = None,
4343
tts: bool = False,
44-
allowed_mentions: typing.List[discord.AllowedMentions] = None):
44+
allowed_mentions: typing.List[discord.AllowedMentions] = None,
45+
hidden: bool = False):
4546
"""
4647
Sends response of the slash command.
4748
49+
.. note::
50+
Param ``hidden`` ONLY works without embeds.
51+
4852
:param send_type: Type of the response. Refer Discord API DOCS for more info about types. Default ``4``.
4953
:type send_type: int
5054
:param content: Content of the response. Can be ``None``.
@@ -55,6 +59,7 @@ async def send(self,
5559
:type tts: bool
5660
:param allowed_mentions: AllowedMentions of the message.
5761
:type allowed_mentions: List[discord.AllowedMentions]
62+
:param hidden: Whether the message is hidden, which means message content will only be seen to the author.
5863
:return: ``None``
5964
"""
6065
if embeds and len(embeds) > 10:
@@ -75,6 +80,8 @@ async def send(self,
7580
"allowed_mentions": [x.to_dict() for x in allowed_mentions] if allowed_mentions
7681
else self._discord.allowed_mentions.to_dict() if self._discord.allowed_mentions else []
7782
}
83+
if hidden:
84+
base["flags"] = 64
7885
initial = True if not self.sent else False
7986
resp = await self._http.post(base, self._discord.user.id, self.interaction_id, self.__token, initial)
8087
self.sent = True

0 commit comments

Comments
 (0)