Last active
December 21, 2021 13:14
-
-
Save sekaiwish/e70b9265ac4b4af3b49fc68bb53529d9 to your computer and use it in GitHub Desktop.
Discord Shadowban Bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't show up in audit log either