RichEmbed字段值可能不为空如何解决?

时间:2019-03-07 00:19:09

标签: bots discord

我不断收到错误消息:RichEmbed字段值可能不为空。并无法找出问题所在。它会做所有事情,而不是根据自己的命令做出反应。 它在chat / userinfo @name中说,但随后给了我错误并且不显示应该显示的信息

const Discord = require ('discord.js');
const bot = new Discord.Client();
const config = require ('./SecretStuff/config.json')
const prefix = config.prefix;
const snek = require ('snekfetch');

bot.on('ready', () => console.log("online!"));

bot.on("guildMemberAdd", (member) => {
    let guild = member.guild;
    let memberTag = member.user.tag;
    if(member.guild.channels.find(channel => channel.name === "welcomechannel"));
       guild.systemChannel.send("/userinfo" + " <@" + member.id + ">" )
    }


);

bot.on('message', async (msg) => {

if (msg.content.startsWith(prefix + "userinfo")) {
    let member = msg.mentions.users.first() || msg.author;
    let userembed = new Discord.RichEmbed()
        .setColor(msg.guild.member(member).highestRole.color)
        .setThumbnail(member.displayAvatarURL)

        .setTitle(`Here is ${member.username}'s info.`)
        .addField(`Name:`, member.username, true)
        .addField(`Id:`, member.id, true)
        .addField(`Bot:`, member.bot ? "Yes" : "No", true)
        .addField("Game:", msg.guild.member(member).presence.game ? msg.guild.member(member).presence.game.name : "Not Playing", true)
        .addField("Nickname:", msg.guild.member(member).nickname ? msg.guild.member(member).nickname : "None", true )
        .addField("Last Messsage:", member.lastMessage, true)
        .addField(`Roles:`, msg.guild.member(member).roles.map(s => s).join(" | "), true)
        .addField("Created At:", member.createdAt, true)
        .addField("JoinedAt:", msg.guild.member(member).joinedAt, true)
        msg.channel.send(userembed);
}

    });

let token = config.token;
bot.login(token)

0 个答案:

没有答案