Example #1
0
# Bot initialization
bot = commands.Bot(command_prefix=commands.when_mentioned_or("n!"),
                   description="Ohaiyooooo! Need my help? (๑˃ᴗ˂)ﻭ")


@bot.event
async def on_ready():
    print('Logged in as {0} ({0.id})'.format(bot.user))
    print('------')


# Add Cog for bot's commands here
bot.add_cog(Music(bot))
bot.add_cog(RNG(bot))
bot.add_cog(Meme(bot))
bot.add_cog(Wolfram(bot))
bot.add_cog(Fun(bot))
bot.add_cog(Steam(bot))


# Helper function for logging
async def update_stats():
    globals.initialize()
    await bot.wait_until_ready()

    while not bot.is_closed():
        try:
            if globals.err:
                with open("log/stats.txt", "a") as f:
                    f.write(
                        f"Time: {int(time.time())}, Command: {globals.last_cmd}, Error message: {globals.err_msg}\n"