Kick all members of a guild except members with a role

MrConorAE

In my Discord bot, I'm trying to develop a "lockdown mode", where the owner and 3 admins send a bot-generated code to trigger a lockdown, where all members of the server except moderators and the bot are kicked. I have the first part done, now I just need a way to kick everyone in the server except those with a specific role. I can get the role ID, that's not a problem, I just need the code for kicking everyone except a role.

Thanks, MrConorAE

Timesis

The only way you can kick everyone from a guild (barring very small guild sizes) in the manner you propose, would be to delete the guild entirely.

There is no way you can achieve kicking large amounts of members within a small period of time, as such an action would spam the Discord API, and result in the termination of your bot.

The best way I could see a 'lockdown mode' being achieved would be to have to bot change the permissions of the general role of your server (whether it is everyone or a Members role) to have permissions to do nothing in you server, and to view none of the channels. This is the only way I could see this result being achieved in a somewhat non-API-spammy way, but to simply kick everyone from the guild, is a task not achievable on a server that has more than ~10 members.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related