diff --git a/lib/src/objects/message/Message.dart b/lib/src/objects/message/Message.dart index d63ad428d..bcc44fa80 100644 --- a/lib/src/objects/message/Message.dart +++ b/lib/src/objects/message/Message.dart @@ -116,14 +116,16 @@ class Message { this.channel.lastMessageID = this.id; /// Safe cast to [GuildChannel] - if (this.channel is GuildChannel) { - this.guild = (this.channel as GuildChannel).guild; + if (this.channel is TextChannel) { + this.guild = (this.channel as TextChannel).guild; this.member = guild.members[this.author.id]; - this.roleMentions = new Map(); - raw['mention_roles'].forEach((String o) { - this.roleMentions[guild.roles[o].id.toString()] = guild.roles[o]; - }); + if(raw['mention_roles'] != null) { + this.roleMentions = new Map(); + raw['mention_roles'].forEach((String o) { + this.roleMentions[guild.roles[o].id.toString()] = guild.roles[o]; + }); + } } if (raw['edited_timestamp'] != null) {