From 815e19ac9f859b1ea93dd02b729d470972037b96 Mon Sep 17 00:00:00 2001 From: Abitofevrything Date: Sat, 16 Sep 2023 21:42:19 +0200 Subject: [PATCH] Fix parsing role mentions --- lib/src/http/managers/message_manager.dart | 2 +- lib/src/models/message/message.dart | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/src/http/managers/message_manager.dart b/lib/src/http/managers/message_manager.dart index 3099bd190..ca9ab46c9 100644 --- a/lib/src/http/managers/message_manager.dart +++ b/lib/src/http/managers/message_manager.dart @@ -54,7 +54,7 @@ class MessageManager extends Manager { 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), diff --git a/lib/src/models/message/message.dart b/lib/src/models/message/message.dart index d230d9817..ab55173eb 100644 --- a/lib/src/models/message/message.dart +++ b/lib/src/models/message/message.dart @@ -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'; @@ -113,7 +112,7 @@ class Message extends PartialMessage { /// A list of users specifically mentioned in this message. final List mentions; - final List roleMentions; + final List roleMentionIds; /// A list of channels specifically mentioned in this message. final List channelMentions; @@ -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, @@ -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.