import asyncio
from asyncio import CancelledError

from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.memory import MemoryStorage
from aiogram.fsm.storage.redis import RedisStorage
from redis import Redis

from tgbot.bots import build_bots, start_bots


async def build() -> list[tuple[Bot, Dispatcher]]:
    return await build_bots()


async def start(bots: list[tuple[Bot, Dispatcher]]):
    await start_bots(bots)


async def main():
    await start(await build())