我正在尝试创建一个使用其ID禁止多个人同时使用的命令。这是我的代码:
const { MessageEmbed } = require("discord.js");
const { MESSAGES } = require("../../util/constants");
module.exports.run = (client, message, args) => {
args.forEach(async id => {
const users = await client.users.fetch(id);
message.guild.member(users).ban;
console.log(users);
})
};
这是我的控制台输出:
User {
id: '409046637948829697',
bot: false,
username: 'NYRIANYRIANYRIA',
discriminator: '4198',
avatar: 'b7f3aed6450d28bbf5b4b1b24809edcb',
flags: UserFlags { bitfield: 64 },
lastMessageID: null,
lastMessageChannelID: null
}
运行命令时没有错误,没有任何追加。感谢您的帮助:)
答案 0 :(得分:0)
.ban是一个函数:GuildMember。ban()
args.forEach(async id => {
const user = await client.users.fetch(id);
const member = message.guild.member(user);
if (member.bannable) member.ban();
else message.channel.send("Cannot ban " + id);
})