From cf06f2007638e599529bb30567a794d038b88a87 Mon Sep 17 00:00:00 2001 From: Trueold89 Date: Wed, 4 Sep 2024 19:45:29 +0300 Subject: [PATCH] Add bot.py --- u232ping/bot.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 u232ping/bot.py 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)