Beispiel #1
0
    def test_start_no_shardcount_no_id(self):
        bot = Client(0, token=env["BOT_TOKEN"])

        @bot.listen("READY")
        async def on_ready(data, shard):
            bot.exit_event.set()

        bot.run()
Beispiel #2
0
    user_id = data["owner"] if check_type == "pokemon" else data["_id"]
    if user_id in banned_users:
        return True
    try:
        is_okay, check_data = await check.execute(data)
    except Exception as e:
        print(f"Check {check_name} failed!")
        raise e
    if not is_okay:
        banned_users.append(user_id)
        await ban(user_id, "Automatic exploit detection", check_violated=check_name.upper(), check_data=check_data)
    return is_okay


async def do_scan():
    this_wave = 0
    # User scans
    users = users_table.find({})

    for db_user in users:
        for check in user_checks:
            check_result = await do_check(check, check.check_id, db_user, check_type="user")
            if not check_result:
                # Check failed, user was banned
                this_wave += 1

    return this_wave


bot.run()
Beispiel #3
0
from speedcord import Client
from speedcord.http import Route
from os import environ as env
from random import choice

client = Client(2)
client.current_shard_count = 1  # Hacky fix until its fixed
client.token = env["TOKEN"]

roles = env["ROLES"].split(";")


@client.listen("GUILD_MEMBER_ADD")
async def on_member_join(data, _):
    user_id = data["user"]["id"]
    guild_id = data["guild_id"]
    route = Route("PUT",
                  "/guilds/{guild_id}/members/{user_id}/roles/{role_id}",
                  guild_id=guild_id,
                  user_id=user_id,
                  role_id=choice(roles))
    await client.http.request(route)


client.run()