import asyncio from aiogram import executor import platform from threading import Thread from bot import dispatcher import ai if platform.system() == 'Windows': asyncio.set_event_loop_policy( asyncio.WindowsSelectorEventLoopPolicy(), ) update_statistics_thread = Thread( target=ai.update_statistics, daemon=True, ) if __name__ == '__main__': update_statistics_thread.start() executor.start_polling( dispatcher, skip_updates=True, )