warning命令将嵌入式消息发送到不同的服务器,而不是执行命令的Discord服务器

时间:2017-07-25 06:18:11

标签: javascript node.js discord

exports.run = (guild, message, args) => {
    let modRole = message.guild.roles.find("name", "Staff");
    if(message.member.roles.has(modRole.id)) {
        let reason = args.slice(1).join(' ');
        let user = message.mentions.users.first();
        let modlog = guild.channels.find('name', 'mod-log');

        if (!modlog) 
            return message.reply('I cannot find a mod-log channel');

        if (reason.length < 1) 
            return message.reply('You must supply a reason for the warning.');

        if (message.mentions.users.size < 1) 
            return message.reply('You must mention someone to warn them.').catch(console.error);

        const embed = new Discord.RichEmbed()
            .setColor(0x8cff00)
            .setTimestamp()
            .setDescription(`**Action:** Warning\n**Target:** ${user.tag}\n**Moderator:** ${message.author.tag}\n**Reason:** ${reason}`);

        return guild.channels.get(modlog.id).send({embed});
    }
};

如何让这段代码将嵌入式消息发送到执行命令的右侧Discord服务器?有些东西告诉我,这段代码在这里做了#34; 让modlog = guild.channels.find(&#39; name&#39;,&#39; MOD-登录&#39); &#34;

1 个答案:

答案 0 :(得分:0)

尝试一下:

return message.channel.send({embed});