def main(): start_time = int(time()) logger = setup_logging(start_time, log_path) loop = get_event_loop() session_manager = loop.run_until_complete(get_session_manager(logger)) with config_path.joinpath('config.json').open() as f: config = load(f) with config_path.joinpath('auth.json').open() as f: auth = load(f) db = MongoClient() if config.get('mongo', True) else None bot = HahaNo4Star(config['default_prefix'], start_time, int(config['colour'], base=16), logger, session_manager, db, auth['error_log'], auth['feedback_log']) bot.remove_command('help') cogs = [Play(bot), Album(bot), Info(bot), Stats(bot), Config(bot)] card_update_thread = Thread(target=update_task) card_update_thread.setDaemon(True) card_update_thread.start() bot.start_bot(cogs, auth['token'])
async def run(): session = ClientSession() config = Config('config.json') start_time = int(time()) logger = setup_logging(start_time, data_path.joinpath('logs')) if config.console_logging: logger.addHandler(get_console_handler()) v = f'{vs.releaselevel} {vs.major}.{vs.minor}.{vs.micro}' if vs.serial: v += f'-{vs.serial}' anime_search = await AnimeSearcher.from_sqlite( {'user': config.mal_user, 'password': config.mal_pass}, DB_PATH / 'minoshiro.db', cache_pages=1, cache_mal_entries=40, logger=logger ) session_manager = anime_search.session_manager data_manager = DataManager(connect(f'{DB_PATH / "yasen_db"}')) wows_api = WowsAsync(config.wows, session) wows_manager = await WowsManager.wows_manager( session_manager, wows_api, logger ) bot = Yasen( logger=logger, version=v, config=config, start_time=start_time, data_manager=data_manager, anime_search=anime_search, wows_manager=wows_manager, wows_api=wows_api ) karen_files = [Path(f) for f in data_path.joinpath('Karen').iterdir()] kanna_files = [Path(f) for f in data_path.joinpath('Kanna').iterdir()] cogs = [Listeners(bot), Fun(bot), Weeb(bot, kanna_files, karen_files), BotInfo(bot), Nsfw(bot), Osu(bot), Utility(bot), Moderation(bot), WorldOfWarships(bot), Music(bot), OwnerOnly(bot)] return bot, cogs