25 lines
581 B
Python
25 lines
581 B
Python
import asyncio
|
|
import json
|
|
|
|
from aiogram import Bot, Dispatcher
|
|
|
|
from . import handlers
|
|
from . import tasks
|
|
|
|
|
|
async def main() -> None:
|
|
with open('tg.json', 'r') as file:
|
|
config = json.load(file)
|
|
print('Конфигурация загружена.')
|
|
|
|
bot = Bot(token=config['api_token'])
|
|
bot.config = config
|
|
|
|
dp = Dispatcher()
|
|
dp.include_router(handlers.router)
|
|
dp.startup.register(tasks.startup_task)
|
|
asyncio.create_task(tasks.daily_maintenance_task(bot))
|
|
await dp.start_polling(bot)
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(main())
|