sysexit() else: print(f'Key {str(e)} not defined in config.ini for "{bot_name}".') print("Shutting down.") sysexit() # Backup wrapper # noinspection PyUnboundLocalVariable # if we get here, bot is guaranteed to be defined @bot.after_invoke async def command_cleanup(ctx: Context): """Run after every command. Backs up the bot and updates the status. """ if ctx.bot.game: await ctx.bot.game.reseat(ctx, ctx.bot.game.seating_order) ctx.bot.backup() await ctx.bot.update_status() # Load extensions for file in listdir("lib/cogs"): if file.endswith(".py") and not file.startswith("_"): bot.load_extension("lib.cogs." + file[:-3]) # Run the bot if __name__ == "__main__": bot.run(config[bot_name]["TOKEN"])
print("Shutting down.") sysexit() else: print(f'Key {str(error)} not defined in config.ini for "{BOT_NAME}".') print("Shutting down.") sysexit() # Backup wrapper # if we get here, bot is guaranteed to be defined @bot.after_invoke async def command_cleanup(ctx: Context): """Run after every command. Backs up the bot and updates the status. """ if ctx.bot.game and ctx.bot.game.current_day: await ctx.bot.game.reseat(ctx, ctx.bot.game.seating_order) ctx.bot.backup() await ctx.bot.update_status() # Load extensions for file in listdir("lib/cogs"): if file.endswith(".py") and not file.startswith("_"): bot.load_extension("lib.cogs." + file[:-3]) # Run the bot if __name__ == "__main__": bot.run(config[BOT_NAME]["TOKEN"])