Skip to content

Commit

Permalink
Fixed wrong AllowedMentions usage
Browse files Browse the repository at this point in the history
  • Loading branch information
eunwoo1104 committed Dec 15, 2020
1 parent ed1c957 commit 8bc3af6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions discord_slash/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def send(self,
content: str = "",
embeds: typing.List[discord.Embed] = None,
tts: bool = False,
allowed_mentions: typing.List[discord.AllowedMentions] = None,
allowed_mentions: discord.AllowedMentions = None,
hidden: bool = False):
"""
Sends response of the slash command.
Expand All @@ -58,7 +58,7 @@ async def send(self,
:param tts: Whether to speak message using tts. Default ``False``.
:type tts: bool
:param allowed_mentions: AllowedMentions of the message.
:type allowed_mentions: List[discord.AllowedMentions]
:type allowed_mentions: discord.AllowedMentions
:param hidden: Whether the message is hidden, which means message content will only be seen to the author.
:return: ``None``
"""
Expand All @@ -70,15 +70,15 @@ async def send(self,
"tts": tts,
"content": content,
"embeds": [x.to_dict() for x in embeds] if embeds else [],
"allowed_mentions": [x.to_dict() for x in allowed_mentions] if allowed_mentions
else self._discord.allowed_mentions.to_dict() if self._discord.allowed_mentions else []
"allowed_mentions": allowed_mentions.to_dict() if allowed_mentions
else self._discord.allowed_mentions.to_dict() if self._discord.allowed_mentions else {}
}
} if not self.sent else {
"content": content,
"tts": tts,
"embeds": [x.to_dict() for x in embeds] if embeds else [],
"allowed_mentions": [x.to_dict() for x in allowed_mentions] if allowed_mentions
else self._discord.allowed_mentions.to_dict() if self._discord.allowed_mentions else []
"allowed_mentions": allowed_mentions.to_dict() if allowed_mentions
else self._discord.allowed_mentions.to_dict() if self._discord.allowed_mentions else {}
}
if hidden:
base["flags"] = 64
Expand All @@ -92,7 +92,7 @@ async def edit(self,
content: str = "",
embeds: typing.List[discord.Embed] = None,
tts: bool = False,
allowed_mentions: typing.List[discord.AllowedMentions] = None):
allowed_mentions: discord.AllowedMentions = None):
"""
Edits response of the slash command.
Expand All @@ -104,7 +104,7 @@ async def edit(self,
:param tts: Whether to speak message using tts. Default ``False``.
:type tts: bool
:param allowed_mentions: AllowedMentions of the message.
:type allowed_mentions: List[discord.AllowedMentions]
:type allowed_mentions: discord.AllowedMentions
:return: ``None``
"""
if embeds and len(embeds) > 10:
Expand All @@ -113,8 +113,8 @@ async def edit(self,
"content": content,
"tts": tts,
"embeds": [x.to_dict() for x in embeds] if embeds else [],
"allowed_mentions": [x.to_dict() for x in allowed_mentions] if allowed_mentions
else self._discord.allowed_mentions.to_dict() if self._discord.allowed_mentions else []
"allowed_mentions": allowed_mentions.to_dict() if allowed_mentions
else self._discord.allowed_mentions.to_dict() if self._discord.allowed_mentions else {}
}
await self._http.edit(base, self._discord.user.id, self.__token, message_id)

Expand Down

0 comments on commit 8bc3af6

Please sign in to comment.