Skip to content

Commit

Permalink
Fix parsing role mentions
Browse files Browse the repository at this point in the history
  • Loading branch information
abitofevrything committed Sep 16, 2023
1 parent 21c94a2 commit 815e19a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/src/http/managers/message_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MessageManager extends Manager<Message> {
isTts: raw['tts'] as bool,
mentionsEveryone: raw['mention_everyone'] as bool,
mentions: parseMany(raw['mentions'] as List, client.users.parse),
roleMentions: parseMany(raw['mention_roles'] as List, client.guilds[Snowflake.zero].roles.parse),
roleMentionIds: parseMany(raw['mention_roles'] as List, Snowflake.parse),
channelMentions: maybeParseMany(raw['mention_channels'], parseChannelMention) ?? [],
attachments: parseMany(raw['attachments'] as List, parseAttachment),
embeds: parseMany(raw['embeds'] as List, parseEmbed),
Expand Down
7 changes: 4 additions & 3 deletions lib/src/models/message/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import 'package:nyxx/src/models/message/reference.dart';
import 'package:nyxx/src/models/message/reaction.dart';
import 'package:nyxx/src/models/channel/text_channel.dart';
import 'package:nyxx/src/models/message/role_subscription_data.dart';
import 'package:nyxx/src/models/role.dart';
import 'package:nyxx/src/models/snowflake.dart';
import 'package:nyxx/src/models/snowflake_entity/snowflake_entity.dart';
import 'package:nyxx/src/models/sticker/sticker.dart';
Expand Down Expand Up @@ -113,7 +112,7 @@ class Message extends PartialMessage {
/// A list of users specifically mentioned in this message.
final List<User> mentions;

final List<Role> roleMentions;
final List<Snowflake> roleMentionIds;

/// A list of channels specifically mentioned in this message.
final List<ChannelMention> channelMentions;
Expand Down Expand Up @@ -194,7 +193,7 @@ class Message extends PartialMessage {
required this.isTts,
required this.mentionsEveryone,
required this.mentions,
required this.roleMentions,
required this.roleMentionIds,
required this.channelMentions,
required this.attachments,
required this.embeds,
Expand All @@ -219,6 +218,8 @@ class Message extends PartialMessage {

/// The webhook that sent this message if it was sent by a webhook, `null` otherwise.
PartialWebhook? get webhook => webhookId == null ? null : manager.client.webhooks[webhookId!];

// Cannot provide roleMentions as we do not have access to the guild.
}

/// The type of a message.
Expand Down

0 comments on commit 815e19a

Please sign in to comment.