我正在尝试使用discord.js发出命令,该命令将在多个服务器上执行命令。 这是我到目前为止所做的。
if (isCommand('globalban', message)) {
if(!member.roles.cache.some(role => role.name === 'Staff'))
return message.reply("You can't use this command.");
var targetID = args[1]; // this is the targets UserID
if (!targetID)
return message.channel.send("Please provide the targets ID");
//rest of code goes here.
return;
}
我不确定该如何继续。
client.guilds.cache.forEach(a => a.ban(targetID))
好吧,只需要让漫游器遍历它所在的所有公会并搜索该用户即可。我可以尝试为您提供一些代码,但idk您正在使用的是discord.js版本。