diff --git a/u232ping/bot.py b/u232ping/bot.py new file mode 100644 index 0000000..71225e9 --- /dev/null +++ b/u232ping/bot.py @@ -0,0 +1,32 @@ +from os import environ +from aiogram import Bot, Dispatcher +from aiogram.client.default import DefaultBotProperties +from aiogram.enums import ParseMode +from aiogram.filters import Command +from aiogram.types import Message +from u232ping.db import Sqlite +from u232ping.controller import Controller + +TOKEN = environ["BOT_TOKEN"] +dp = Dispatcher() +c = Controller(Sqlite()) + + +@dp.message(Command("all")) +async def all(message: Message) -> None: + await c.all(message) + + +@dp.message(Command("1")) +async def first(message: Message) -> None: + await c.first(message) + + +@dp.message(Command("2")) +async def second(message: Message) -> None: + await c.second(message) + + +async def main() -> None: + bot = Bot(token=TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML)) + await dp.start_polling(bot)