Skip to content

Instantly share code, notes, and snippets.

@WorkingCodeClickFork
Forked from vivekjoshy/discord-ban-bot.py
Last active July 12, 2021 22:57
Show Gist options
  • Save WorkingCodeClickFork/826fed0fabccb824ec9ea4fc86956200 to your computer and use it in GitHub Desktop.
Save WorkingCodeClickFork/826fed0fabccb824ec9ea4fc86956200 to your computer and use it in GitHub Desktop.
Script to ban members of a discord servers.
#!/usr/bin/python
"""
# WARNING!
# DO not use this script for malicious purposes!
# Original Author: daegontaven - taven#0001
# License: Public Domain
#How to use:
#make a bot
#make the bot inside the bot
#enable all the intents for the bot
#run this script
#boom everyone gets banned(if the bot is in the server)
# How to Install
1 - Download Python 3.7 or 3.6 : https://www.python.org/downloads/
2 - Run this command : python3 -m pip install discord.py
3 - Run this command : python3 discord-ban-bot.py
4 - Invite bot to the servers you want to ban members from.
5 - Wait until banning is done. Don't close the terminal. This may take a while.
"""
import discord
from discord.ext import commands
client = commands.Bot("!", intents=discord.Intents.all())
Token="" #bot token
Skip_Bots=False
send_on_ban=False # if True it will send a dm to the user
ban_message="You were banned!" # the message if send_on_ban is true
@client.event
async def on_ready():
for i in client.guilds: #Get all the guilds
for m in i.members: #Get all the members inside the guild
if m.bot and Skip_Bots!=False:
return
try:
if send_on_ban==True:
try:
await m.send(ban_message)
print(f"Dmmed {m.display_name}")
except:
print(f"Couldn't dm {m.display_name}")
pass
await m.ban(reason="Banned by banbot")
print(f"banned {m.display_name}")
except:
print(f"Couldn't Ban {m.display_name}")
print("Banning Completed")
client.run(Token)
@WorkingCodeClickFork
Copy link
Author

Make a workinf verison in revisions :/

@Bohenek
Copy link

Bohenek commented Jul 12, 2021

wdym Make the bot inside a bot?

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