I am trying to make a discord.js avatar command, and the mentioning portion doesn't work correctly

前端 未结 3 1156
情深已故
情深已故 2020-12-21 22:59

I have an avatar command in my discord bot. When the user uses h.avatar, it outputs their avatar, which works fine. Whenever they try to use h.avatar @use

3条回答
  •  既然无缘
    2020-12-21 23:55

     if (message.content.startsWith(prefix + 'avatar')) {
       let user = message.mentions.users.first();
       if(!user) user = message.author;
       let color = message.member.displayHexColor;
       if (color == '#000000') color = message.member.hoistRole.hexColor;
       const embed = new Discord.RichEmbed()
                       .setImage(user.avatarURL)
                       .setColor(color)
        message.channel.send({embed});
     }
    

提交回复
热议问题