无法将禁止原因添加到我的不和谐机器人

时间:2020-07-31 19:50:16

标签: javascript node.js discord discord.js

嗨,我有这个禁止命令,我希望能够指定一个原因,但是我不知道该怎么做?我尝试过的所有方法都没有奏效,因此将不胜感激

client.on("message", (message) => {
    if (message.content.startsWith("!ban")) {
        if(message.member.permissions.has("BAN_MEMBERS")){
            const member = message.mentions.members.first();
            if (member){
                member.ban().then((member) => {
                    message.channel.send(":anger: " + member.displayName + " has been successfully banned. ");
                }).catch(() => {
                    message.channel.send(":exclamation: Oops! Please try again.");
                })
            } else {
                message.channel.send(':exclamation: Please enter a user in the server and try again.');
            }
        } else {
            message.channel.send(':no_entry_sign: You do not have permission.');
        }
    }
});

1 个答案:

答案 0 :(得分:1)

GuildMember.ban({reason: "This is the reason."})