I am trying to make a command using discord.js that would execute a command on multiple servers.
this is what I have done so far.
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;
}
I am not sure on how to continue this.
client.guilds.cache.forEach(a => a.members.ban(targetID))
well, just have the bot loop through all the guilds it’s in and search for that user. I could try giving you some code, but idk what version of discord.js you are using.
EDIT: in discord.js v12 —>
client.guilds.cache.forEach(a => a.members.cache.get(targetID.)ban()
First, where and how does the bot stocks the IDs. Second, is there an gunban command ?