Skip to content

Commit dc77648

Browse files
committed
Completely implemented edit
1 parent c57c1f1 commit dc77648

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

discord_slash/model.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,34 +89,32 @@ async def send(self,
8989

9090
async def edit(self,
9191
message_id: typing.Union[int, str] = "@original",
92-
send_type: int = 4,
93-
text: str = "",
92+
content: str = "",
9493
embeds: typing.List[discord.Embed] = None,
95-
tts: bool = False):
94+
tts: bool = False,
95+
allowed_mentions: typing.List[discord.AllowedMentions] = None):
9696
"""
9797
Edits response of the slash command.
9898
9999
:param message_id: Response message ID. Default initial message.
100-
:param send_type: Type of the response. Refer Discord API DOCS for more info about types. Default ``4``.
101-
:type send_type: int
102-
:param text: Text of the response. Can be ``None``.
103-
:type text: str
100+
:param content: Text of the response. Can be ``None``.
101+
:type content: str
104102
:param embeds: Embeds of the response. Maximum 10, can be empty.
105103
:type embeds: List[discord.Embed]
106104
:param tts: Whether to speak message using tts. Default ``False``.
107105
:type tts: bool
106+
:param allowed_mentions: AllowedMentions of the message.
107+
:type allowed_mentions: List[discord.AllowedMentions]
108108
:return: ``None``
109109
"""
110110
if embeds and len(embeds) > 10:
111111
raise error.IncorrectFormat("Embed must be 10 or fewer.")
112112
base = {
113-
"type": send_type,
114-
"data": {
115-
"tts": tts,
116-
"content": text,
117-
"embeds": [x.to_dict() for x in embeds] if embeds else [],
118-
"allowed_mentions": []
119-
}
113+
"content": content,
114+
"tts": tts,
115+
"embeds": [x.to_dict() for x in embeds] if embeds else [],
116+
"allowed_mentions": [x.to_dict() for x in allowed_mentions] if allowed_mentions
117+
else self._discord.allowed_mentions.to_dict() if self._discord.allowed_mentions else []
120118
}
121119
await self._http.edit(base, self._discord.user.id, self.__token, message_id)
122120

0 commit comments

Comments
 (0)