如何为不和谐机器人添加踢或禁止的自定义原因

时间:2021-02-23 03:25:09

标签: javascript discord

所以,这是我的机器人踢命令的代码,我对 discord.js 的 API 很陌生,我想让用户在踢/禁止某人时给出自定义原因有人可以帮助我这个,我试过教程,但似乎没有人包含自定义原因部分。

module.exports = {
    name: 'kick',
    description: "This command kicks a member!",
    execute(client, message, args) {
        if (!message.member.permissions.has('KICK_MEMBERS')) return message.reply("You do not have the required permissions");
        if (client.user.id == message.mentions.members.first().id) return message.reply("You cannot kick me!!");
        if (message.author.id == message.mentions.members.first().id) return message.reply("Why are you trying to kick yourself??");
        const target = message.mentions.users.first();
        if (target) {
            const memberTarget = message.guild.members.cache.get(target.id);
            memberTarget.kick();
            message.reply(memberTarget + " has been kicked");
        } else {
            message.reply(`Please mention a user in this server`);
        }
    }
}

0 个答案:

没有答案