add (some) sticker support
This commit is contained in:
parent
4db1b48c71
commit
3b47e5af3f
2 changed files with 17 additions and 0 deletions
|
@ -34,6 +34,13 @@ class MessageReference:
|
|||
guild_id: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class Sticker:
|
||||
name: str
|
||||
id: str
|
||||
format_type: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class Typing:
|
||||
user_id: str
|
||||
|
@ -114,6 +121,11 @@ class Message:
|
|||
|
||||
self.author = User(author) if author else None
|
||||
|
||||
self.stickers = [
|
||||
dict_cls(sticker, Sticker)
|
||||
for sticker in message.get("sticker_items", [])
|
||||
]
|
||||
|
||||
|
||||
class ChannelType:
|
||||
GUILD_TEXT = 0
|
||||
|
|
|
@ -656,6 +656,11 @@ class DiscordClient(Gateway):
|
|||
for attachment in message.attachments:
|
||||
content += f"\n{attachment['url']}"
|
||||
|
||||
# Append stickers to message.
|
||||
for sticker in message.stickers:
|
||||
if sticker.format_type != 3: # 3 == Lottie format.
|
||||
content += f"\n{discord.CDN_URL}/stickers/{sticker.id}.png"
|
||||
|
||||
return content, emotes
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue