Skip to content

Instantly share code, notes, and snippets.

@sekaiwish
Last active December 21, 2021 13:14
Show Gist options
  • Save sekaiwish/e70b9265ac4b4af3b49fc68bb53529d9 to your computer and use it in GitHub Desktop.
Save sekaiwish/e70b9265ac4b4af3b49fc68bb53529d9 to your computer and use it in GitHub Desktop.
Discord Shadowban Bot
#!/usr/bin/python -u
import os, asyncio, discord
from discord.ext import commands
owner = 119094696487288833
shadowed = {} # user IDs as ints
intents = discord.Intents.none()
intents.guild_messages = True
bot = commands.Bot(command_prefix='.', owner_id=owner, intents=intents)
def setup_files(*files):
for file in files:
if not os.path.isfile(file):
if os.path.exists(file): raise Exception('Require file exists as dir')
f = open(file, 'x')
setup_files('token')
with open('token', 'r+') as fp:
if not fp.read():
token = input('Token: ')
fp.write(token)
else:
fp.seek(0); token = fp.read()
print('Using existing token')
@bot.event
async def on_message(rx):
if rx.author.id in shadowed:
await rx.delete()
@bot.event
async def on_ready():
print(f'Logged into {bot.user.name}#{bot.user.discriminator}')
await bot.change_presence(status=discord.Status.invisible)
bot.run(token)
@sekaiwish
Copy link
Author

Doesn't show up in audit log either

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