Discord.js中的Ban命令无法编译

时间:2020-05-07 12:05:02

标签: discord.js

我有一个禁止用户的命令。我尝试将最后一部分更改为几个不同的变体,但是如果我尝试使用modChannel.message.send,则会抛出错误“ modChannel已经定义”。我不确定该怎么办。


module.exports = {
  name: "ban",
  description: "Ban the troublesome users!",

  execute(message, args) {
        let member = message.mentions.user.first();
    if(!message.member.roles.some(r=>["Administrator"].includes(r.name))) {
      return message.channel.send("You don't have the permissions to use this command!");
    }
    if(!member.bannable) {
      return message.channel.send("I can\'t ban this person. Please try again. Make sure I have ban permissions.");
    }

    let reason = args.slice(7).join(" ");
    if(!reason) {
      reason = "No reason was provided.";
    }

    let modChannel = client.guilds.find(ch => ch.name === "mod-log");
    const banEmbed = {
      color: 225,
      title: "User Banned",
      description: `**User**: ${member.username}#${member.discriminator} (${member.id})
      **Reason**: ${reason}
      **Banned By**: ${message.author.username}#${message.author.discriminator}`,
    },

      modChannel.send({embed: banEmbed });
},
};

0 个答案:

没有答案