Skip to content

Commit

Permalink
Fix Message.cleanContent for members without nicks
Browse files Browse the repository at this point in the history
  • Loading branch information
abalabahaha committed Oct 25, 2017
1 parent 389a9a6 commit d8b7d39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/structures/Message.js
Expand Up @@ -128,8 +128,8 @@ class Message extends Base {
this.mentions.forEach((mention) => {
if(this.channel.guild) {
var member = this.channel.guild.members.get(mention.id);
if(member) {
cleanContent = cleanContent.replace(new RegExp(`<@!?${mention.id}>`, "g"), "@" + member.nick || mention.username);
if(member && member.nick) {
cleanContent = cleanContent.replace(new RegExp(`<@!?${mention.id}>`, "g"), "@" + member.nick);
}
}
cleanContent = cleanContent.replace(new RegExp(`<@!?${mention.id}>`, "g"), "@" + mention.username);
Expand Down

0 comments on commit d8b7d39

Please sign in to comment.