mirror of
https://github.com/osmarks/autobotrobot
synced 2024-11-05 00:06:17 +00:00
Heavserver Role Addition Engine™
This commit is contained in:
parent
e8fbebcbaa
commit
9562f66f32
22
src/heavserver.py
Normal file
22
src/heavserver.py
Normal file
@ -0,0 +1,22 @@
|
||||
import util
|
||||
import random
|
||||
import logging
|
||||
import discord
|
||||
|
||||
def setup(bot):
|
||||
@bot.listen()
|
||||
async def on_member_join(member):
|
||||
if member.guild.id == util.config["heavserver"]["id"]:
|
||||
logging.info("%s (%d) joined heavserver", member.name, member.id)
|
||||
if member.bot:
|
||||
print(member.guild, member.guild.roles)
|
||||
await member.add_roles(discord.utils.get(member.guild.roles, id=util.config["heavserver"]["quarantine_role"]))
|
||||
mod_roles = set()
|
||||
can_add = util.config["heavserver"]["moderator_roles"][:]
|
||||
while True:
|
||||
x = random.choice(can_add)
|
||||
role = discord.utils.get(member.guild.roles, id=x)
|
||||
mod_roles.add(role)
|
||||
can_add.remove(x)
|
||||
if random.randint(0, 3) != 0 or len(can_add) == 0: break
|
||||
await member.add_roles(*mod_roles)
|
@ -22,11 +22,13 @@ config = util.config
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(asctime)s %(message)s", datefmt="%H:%M:%S %d/%m/%Y")
|
||||
|
||||
#intents = discord.Intents.default()
|
||||
#intents.members = True
|
||||
|
||||
bot = commands.Bot(command_prefix=config["prefix"], description="AutoBotRobot, the most useless bot in the known universe.",
|
||||
case_insensitive=True, allowed_mentions=discord.AllowedMentions(everyone=False, users=True, roles=True))
|
||||
bot._skip_check = lambda x, y: False
|
||||
|
||||
|
||||
cleaner = discord.ext.commands.clean_content()
|
||||
def clean(ctx, text):
|
||||
return cleaner.convert(ctx, text)
|
||||
@ -216,7 +218,8 @@ async def run_bot():
|
||||
"reminders",
|
||||
"debug",
|
||||
"telephone",
|
||||
"achievement"
|
||||
"achievement",
|
||||
"heavserver"
|
||||
):
|
||||
bot.load_extension(ext)
|
||||
await bot.start(config["token"])
|
||||
|
Loading…
Reference in New Issue
Block a user