Esempio n. 1
0
async def on_ready():

    for guild in bot.guilds:
        bot.guild = guild

    # Roles

    bot.owner_role = discord.utils.get(guild.roles, name=botcfg.OwnerRole)
    bot.admin_role = discord.utils.get(guild.roles, name=botcfg.AdminRole)
    bot.mod_role = discord.utils.get(guild.roles, name=botcfg.ModRole)

    if botcfg.approvalSystemEnabled:
        bot.approved_role = discord.utils.get(guild.roles,
                                              name=botcfg.approvedRole)

    bot.messagelogs_channel = discord.utils.get(
        guild.channels, name=botcfg.messagelogs_channel)
    bot.memberlogs_channel = discord.utils.get(guild.channels,
                                               name=botcfg.memberlogs_channel)
    bot.modlogs_channel = discord.utils.get(guild.channels,
                                            name=botcfg.modlogs_channel)

    logger = Logger(__name__, bot.modlogs_channel)

    # Notify user if an addon fails to load.
    for addon in botcfg.addons:
        try:
            bot.load_extension("addons." + addon)
        except Exception as e:
            logger.warn("Failed to load {}:\n{}".format(
                addon, "".join(format_exception(type(e), e, e.__traceback__))))

    # Notify user if a spacecog fails to load.
    for addon in botcfg.cogs:
        try:
            bot.load_extension("cogs." + addon)
        except Exception as e:
            logger.warn("Failed to load {}:\n{}".format(
                addon, "".join(format_exception(type(e), e, e.__traceback__))))

    print(
        f"Client logged in as {bot.user.name}, in the following guild : {guild.name}"
    )
Esempio n. 2
0
 def __init__(self, bot):
     self.bot = bot
     self.modlog = Logger(__name__, bot.modlogs_channel)
Esempio n. 3
0
 def __init__(self, bot):
     self.bot = bot
     self.lockmsg = ":lock: Channel locked."
     self.unlockmsg = ":unlock: Channel Unlocked"
     self.modlog = Logger(__name__, bot.modlogs_channel)
Esempio n. 4
0
 def __init__(self, bot):
     self.bot = bot
     self.logger = Logger(__name__, bot.memberlogs_channel)
Esempio n. 5
0
 def __init__(self, bot):
     self.bot = bot
     self.role = get(bot.guild.roles, name=MuteRole)
     self.modlog = Logger(__name__, bot.modlogs_channel)