我做了一个不和谐的机器人我的禁令命令有效,但我的踢命令无效

时间:2021-05-11 08:08:08

标签: discord.js

Error: NudgeTrigger(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.

2 个答案:

答案 0 :(得分:2)

可以在成员对象本身使用kick函数

试试这个

return member.kick()
  .then(() => message.reply(`${member.user.username} was kicked.`))
  .catch(error => message.reply('They are above my paygrade'));

答案 1 :(得分:0)

试试这个

const { getUserFromMention } = require("../userinfo/getuser.js");

module.exports = {
    name: "kick",
    description: "kick a player",
    execute(message, client) {
        const split = message.content.split(/ +/);
        const args = split.slice(1);

        const member = getUserFromMention(args[0], client);

        if (!member) {
            return message.reply("Say the name lets dew it !");
        }

        if (!message.member.permissions.has("KICK_MEMBERS")) {
            return message.reply("I can't kick this user.");
        }

       return member.kick()
       .then(() => message.reply(`${member.user.username} was kicked.`))
       .catch(error => message.reply('They are above my paygrade'));
     },
};