Esempio n. 1
0
async def on_guild_join(bot, guild: Guild):
    blocked = Configuration.get_persistent_var("server_blocklist", [])
    if guild.id in blocked:
        GearbotLogging.info(
            f"Someone tried to add me to blocked guild {guild.name} ({guild.id})"
        )
        try:
            await guild.owner.send(
                "Someone tried adding me to {guild.name} (``{guild.id}``) but the server has been blocked"
            )
        except Exception:
            pass
        await guild.leave()
    elif guild.owner_id in Configuration.get_persistent_var(
            "user_blocklist", []):
        GearbotLogging.info(
            f"Someone tried to add me to {Utils.clean(guild.name)} ({guild.id}) but the owner ({guild.owner} ({guild.owner_id})) is blocked"
        )
        try:
            await (await bot.fetch_user(guild.owner_id)).send(
                f"Someone tried adding me to {guild.name} (``{guild.id}``) but you have been blocked due to bot abuse, so i left"
            )
        except Exception:
            pass
        await guild.leave()
    else:
        bot.missing_guilds.add(guild.id)
        await guild.chunk(cache=True)
        bot.missing_guilds.remove(guild.id)
        GearbotLogging.info(f"A new guild came up: {guild.name} ({guild.id}).")
        Configuration.load_config(guild.id)
        name = await Utils.clean(guild.name)
        await GearbotLogging.bot_log(
            f"{Emoji.get_chat_emoji('JOIN')} A new guild came up: {name} ({guild.id}).",
            embed=server_info.server_info_embed(guild))
Esempio n. 2
0
async def on_guild_join(bot, guild: Guild):
    blocked = Configuration.get_persistent_var("server_blocklist", [])
    if guild.id in blocked:
        await guild.leave()
        await GearbotLogging.bot_log(f"Someone tried to add me to blocked guild {await Utils.clean(guild.name)} ({guild.id})")
    elif guild.owner_id in Configuration.get_persistent_var("user_blocklist", []):
        await guild.leave()
        await GearbotLogging.bot_log(f"Someone tried to add me to {await Utils.clean(guild.name)} ({guild.id}) but the owner {guild.owner_id} is blocked")
    else:
        GearbotLogging.info(f"A new guild came up: {guild.name} ({guild.id}).")
        Configuration.load_config(guild.id)
        name = await Utils.clean(guild.name)
        await guild.chunk(cache=True)
        await GearbotLogging.bot_log(f"{Emoji.get_chat_emoji('JOIN')} A new guild came up: {name} ({guild.id}).", embed=ServerInfo.server_info_embed(guild))
Esempio n. 3
0
async def on_guild_join(guild):
    blocked = Configuration.get_persistent_var("blacklist", [])
    if guild.id in blocked:
        GearbotLogging.info(
            f"Someone tried to add me to blacklisted guild {guild.name} ({guild.id})"
        )
        try:
            await guild.owner.send(
                "Someone tried adding me to {guild.name} (``{guild.id}``) but the server has been blacklisted"
            )
        except Exception:
            pass
        await guild.leave()
    else:
        GearbotLogging.info(f"A new guild came up: {guild.name} ({guild.id}).")
        Configuration.load_config(guild.id)
        name = await Utils.clean(guild.name)
        await GearbotLogging.bot_log(
            f"{Emoji.get_chat_emoji('JOIN')} A new guild came up: {name} ({guild.id}).",
            embed=server_info.server_info(guild))
Esempio n. 4
0
async def on_guild_join(guild):
    GearbotLogging.info(f"A new guild came up: {guild.name} ({guild.id}).")
    Configuration.load_config(guild.id)
    await GearbotLogging.bot_log(
        f"{Emoji.get_chat_emoji('JOIN')} A new guild came up: {guild.name} ({guild.id}).",
        embed=Utils.server_info(guild))
Esempio n. 5
0
async def on_guild_join(guild: discord.Guild):
    Logging.info(f"A new guild came up: {guild.name} ({guild.id}).")
    Configuration.load_config(guild.id)