Add bot.py
This commit is contained in:
parent
4b09cd91b5
commit
cf06f20076
|
@ -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)
|
Loading…
Reference in New Issue