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
|
guild_id: str
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Sticker:
|
||||||
|
name: str
|
||||||
|
id: str
|
||||||
|
format_type: int
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Typing:
|
class Typing:
|
||||||
user_id: str
|
user_id: str
|
||||||
|
@ -114,6 +121,11 @@ class Message:
|
||||||
|
|
||||||
self.author = User(author) if author else None
|
self.author = User(author) if author else None
|
||||||
|
|
||||||
|
self.stickers = [
|
||||||
|
dict_cls(sticker, Sticker)
|
||||||
|
for sticker in message.get("sticker_items", [])
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class ChannelType:
|
class ChannelType:
|
||||||
GUILD_TEXT = 0
|
GUILD_TEXT = 0
|
||||||
|
|
|
@ -656,6 +656,11 @@ class DiscordClient(Gateway):
|
||||||
for attachment in message.attachments:
|
for attachment in message.attachments:
|
||||||
content += f"\n{attachment['url']}"
|
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
|
return content, emotes
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue