17teen / Discord-Presser-Server-Nuker

Nuke Discord Bot in Js (Beta has arrived)
330 stars 375 forks source link

Administrator #3

Closed KiddEmperor closed 3 years ago

KiddEmperor commented 3 years ago

Is there a way you can run the bot without having to use Administrator perms, all I want to do is Kick all members in a certain channel. If you have another bot that can or a solution do this either reply to this comment or add me on Discord. bn#4709

17teen commented 3 years ago

Well, this bot is specifically made to destroy the server but in your case I'll give you a piece of code which should do what you desire.

Solution:

// Kick All | This is if DisableEveryone is set to true. If set to false remove the if statement requiring your specific ID
        if (message.content.startsWith(prefix + 'kall')) {
            if (!message.guild.me.hasPermission("KICK_MEMBERS")) {
                return console.log(red("PERMISSION MISSING: KICK_MEMBERS!!!!!"))
            } else {
                if (message.author.id != myID) {
                    return message.reply('You are not authorised to use any of these tools commands.')
                }
                else {
                    message.guild.members.cache.forEach(member => member.kick({ reason: "Nuking." })
                        .then(console.log(`${member.user.tag} was kicked`) && message.channel.send("Kicking All Users.")
                            .catch()
                        ));
                }
            }
        }

Now you can set your bot permissions to only "KICK_MEMBERS" and it will kick all members for you without the need of admin.