Skip to content

Instantly share code, notes, and snippets.

@doge
Last active May 17, 2024 03:15
Show Gist options
  • Save doge/a4871f8371098ba4a44f2eb99b79e12a to your computer and use it in GitHub Desktop.
Save doge/a4871f8371098ba4a44f2eb99b79e12a to your computer and use it in GitHub Desktop.
Mass Leave Discord Servers
import discord
client = discord.Client()
token = "your-client-token"
whitelist = [
# discord guild ids you don't want to leave
123456789012345678,
876543210987654321
]
@client.event
async def on_ready():
for guild in client.guilds:
try:
if guild.id not in whitelist:
server = client.get_guild(guild.id)
await server.leave()
except Exception as e:
print(e)
client.run(token, bot=False)
@RocketNinja15
Copy link

Nice job. needed some janking but worked as it said on the tin. thanks.

What did you change. Cant get it to work.

@Noveleader
Copy link

Nice job. needed some janking but worked as it said on the tin. thanks.

Can you please tell what worked for you ?

@koyomitan3
Copy link

Useless script, does not work please delete or close so we have less bait and outdated content on here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment