Ejemplo n.º 1
0
    async def on_first_ready():
        # Set up logging.
        logChannel = bot.get_channel(conf.logchannelid)
        discordhandler = DiscordHandler(logChannel)
        logger.addHandler(discordhandler)

        # Print the splash screen.
        LOGIN = digilogger.addLogLevel("login", fg="cyan")
        logger.log(LOGIN, f"Logged in as: {bot.user.name} ({bot.user.id})\n------")

        # Add a special message to bot status if we are running in debug mode
        activity = discord.Game(name = "DigiBot")
        if conf.activity:
            activity = discord.Game(name = conf.activity)
        if sys.gettrace() is not None:
            activity = discord.Activity(type=discord.ActivityType.listening, name = "DEBUGGER 🔧")

        # More splash screen.
        await bot.change_presence(activity = activity)
        print(styles)
        logger.info(f"Prefix: {conf.prefix}")
        launchfinishtime = datetime.now()
        elapsed = launchfinishtime - launchtime
        logger.debug(f"DigiBot launched in {round((elapsed.total_seconds() * 1000), 3)} milliseconds.\n")
        status.ready()
Ejemplo n.º 2
0
    async def on_first_ready():
        # Set up logging.
        logChannel = bot.get_channel(conf.logchannelid)
        discordhandler = DiscordHandler(logChannel)
        logger.addHandler(discordhandler)

        # Set the bots name to what's set in the config.
        await bot.user.edit(username=conf.name)

        # Start the language engine.
        language.load()

        # Load the units and objects.
        await units.init()
        await objs.init()

        # Print the splash screen.
        BANNER = digilogger.addLogLevel("banner",
                                        fg="orange_red_1",
                                        bg="deep_sky_blue_4b",
                                        attr="bold")
        LOGIN = digilogger.addLogLevel("login", fg="cyan")
        # Obviously we need the banner printed in the terminal
        logger.log(BANNER, conf.banner + " v" + __version__)
        logger.log(LOGIN,
                   f"Logged in as: {bot.user.name} ({bot.user.id})\n------")

        # Add a special message to bot status if we are running in debug mode
        activity = discord.Game(name="Ratchet and Clank: Size Matters")
        if sys.gettrace() is not None:
            activity = discord.Activity(type=discord.ActivityType.listening,
                                        name="DEBUGGER 🔧")

        # More splash screen.
        await bot.change_presence(activity=activity)
        print(styles)
        logger.info(f"Prefix: {conf.prefix}")
        launchfinishtime = datetime.now()
        elapsed = launchfinishtime - launchtime
        logger.debug(
            f"SizeBot launched in {round((elapsed.total_seconds() * 1000), 3)} milliseconds.\n"
        )
        status.ready()
Ejemplo n.º 3
0
def create_log_levels():
    global BANNER, LOGIN, EGG, CMD, ROYALE
    BANNER = digilogger.addLogLevel("banner",
                                    fg="orange_red_1",
                                    bg="deep_sky_blue_4b",
                                    attr="bold",
                                    showtime=False)
    LOGIN = digilogger.addLogLevel("login", fg="cyan")
    EGG = digilogger.addLogLevel("egg",
                                 fg="magenta_2b",
                                 bg="light_yellow",
                                 attr="bold",
                                 prefix="EGG")
    CMD = digilogger.addLogLevel("cmd",
                                 fg="grey_50",
                                 base="DEBUG",
                                 prefix="CMD")
    ROYALE = digilogger.addLogLevel("royale",
                                    fg="cyan",
                                    base="DEBUG",
                                    prefix="ROYALE")