add (some) sticker support

This commit is contained in:
git-bruh 2021-07-04 15:08:32 +05:30
parent 4db1b48c71
commit 3b47e5af3f
No known key found for this signature in database
GPG key ID: E1475C50075ADCE6
2 changed files with 17 additions and 0 deletions

View file

@ -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

View file

@ -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