How much would a discord bot go for that can unban everyone in your server I need one so lmk
- Type
- Requesting
const Discord = require ("discord.js");
const bot = new Discord.Client({disableEveryone: true});
let prefix = "-"
bot.on("ready", async () => {
console.log(`${bot.user.username} is now online!`)
});
bot.on("message", async message => {
if(message.author.bot || message.channel.type === "dm") return;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
if(cmd === `${prefix}unbanall`) {
let bannedList = await message.guild.fetchBans();
let bannedUsers = bannedList.map(user => message.guild.unban(user))
message.channel.send("UNBANNED ALL") // Set this to anything, just placeholder text
}
})
bot.login("TOKEN");
Maybe add an async function to handle ratelimit?Code:const Discord = require ("discord.js"); const bot = new Discord.Client({disableEveryone: true}); let prefix = "-" bot.on("ready", async () => { console.log(`${bot.user.username} is now online!`) }); bot.on("message", async message => { if(message.author.bot || message.channel.type === "dm") return; let messageArray = message.content.split(" "); let cmd = messageArray[0]; let args = messageArray.slice(1); if(cmd === `${prefix}unbanall`) { let bannedList = await message.guild.fetchBans(); let bannedUsers = bannedList.map(user => message.guild.unban(user)) message.channel.send("UNBANNED ALL") // Set this to anything, just placeholder text } }) bot.login("TOKEN");
I didn't get a chance to test it fully but tested it with one user banned and it worked, not sure if there's an easier way or more efficient way to do it but if it works then all good lol
if you don't know how to use just download node.js, make a file called index.js or app.js, put your bots token at the bottom and then open command prompt at the same location as your file, do npm install discord.js then node index.js or node app.js
If I wasn't on holiday & on my phone I'd add some more, feel free to copy and add to it if you see a better fit, I'm still pretty newbie at this stuff to be truthful, lol.Maybe add an async function to handle ratelimit?
const Discord = require ("discord.js");
const bot = new Discord.Client({disableEveryone: true});
let prefix = "-";
bot.on("ready", async () => {
console.log(`${bot.user.username} is now online!`)
});
bot.on("message", async message => {
if(message.author.bot || message.channel.type === "dm") return;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
if(cmd === `${prefix}unbanall`) {
let bannedList = await message.guild.fetchBans();
let bannedUsers = bannedList.map(async user => await message.guild.unban(user))
message.channel.send("All users have been unbanned.") // Set this to anything, just placeholder text
}
})
bot.login("Your bot token");
