Skip to content

Commit

Permalink
add new fields on message snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexedia committed Oct 10, 2024
1 parent 527eed5 commit 3cad106
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/src/http/managers/message_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ class MessageManager extends Manager<Message> {
// https://github.com/discord/discord-api-docs/issues/7193
roleMentionIds: maybeParseMany(raw['mention_roles'] as List?, Snowflake.parse) ?? [],
type: MessageType(raw['type'] as int),
stickers: parseMany(raw['sticker_items'] as List? ?? [], client.stickers.parseStickerItem),
components: maybeParseMany(raw['components'], parseMessageComponent),
);
}

Expand Down
12 changes: 10 additions & 2 deletions lib/src/models/message/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ class Message extends PartialMessage implements MessageSnapshot {
/// The thread that was started from this message if any, `null` otherwise.
final Thread? thread;

/// A list of components in this message.
@override
final List<MessageComponent>? components;

/// List of sticker attached to message
@override
final List<StickerItem> stickers;

/// A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of this message in a thread.
Expand Down Expand Up @@ -492,6 +492,12 @@ class MessageSnapshot with ToStringHelper {
/// A list of roles mentioned in the message.
final List<Snowflake> roleMentionIds;

/// A list of Stickers attached to this message.
final List<StickerItem> stickers;

/// A list of components in this message.
final List<MessageComponent>? components;

/// @nodoc
MessageSnapshot({
required this.timestamp,
Expand All @@ -503,6 +509,8 @@ class MessageSnapshot with ToStringHelper {
required this.flags,
required this.mentions,
required this.roleMentionIds,
required this.stickers,
required this.components,
});
}

Expand Down

0 comments on commit 3cad106

Please sign in to comment.