diff --git a/appservice/discord.py b/appservice/discord.py index 3ec166c..5c4907d 100644 --- a/appservice/discord.py +++ b/appservice/discord.py @@ -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 diff --git a/appservice/main.py b/appservice/main.py index 0624247..edf4bb0 100644 --- a/appservice/main.py +++ b/appservice/main.py @@ -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