22
33from beanie import init_beanie
44
5- from aiogram import Bot , types
5+ from aiogram import types
66from aiogram .dispatcher import Dispatcher
77
88from aiogram .contrib .fsm_storage .memory import MemoryStorage
1111from aiogram .utils import executor
1212from apscheduler .schedulers .asyncio import AsyncIOScheduler
1313
14- from bot .bot_instance import bot , loop
14+ from bot .bot_instance import bot , loop , version as bot_version , link , codename
1515
1616from bot .core .database import db
1717
2626
2727scheduler = AsyncIOScheduler ()
2828
29- # storage = RedisStorage2(db=2)
30-
31- # storage = RedisStorage2(
32- # host="redis:/localhost",
33- # port=6379,
34- # db=7,
35- # )
36-
3729dp = Dispatcher (
3830 bot ,
3931 loop = loop ,
@@ -69,6 +61,7 @@ async def startup(dp: Dispatcher):
6961 ),
7062 types .BotCommand (command = "/ping" , description = "Перевірити чи працює бот" ),
7163 types .BotCommand (command = "/time" , description = "Поточний час сервера" ),
64+ types .BotCommand (command = "/version" , description = "Версія бота" ),
7265 ]
7366
7467 await bot .set_my_commands (commands )
@@ -94,6 +87,14 @@ async def time(message: types.Message):
9487 await message .answer (f"Server time is: { str (datetime .datetime .now ())} " )
9588
9689
90+ @dp .message_handler (commands = ["version" ])
91+ async def version (message : types .Message ):
92+ await message .answer (
93+ f"Bot version:\n *v{ bot_version } *\n \n Source Code:\n [denver-code/passport-status-bot/{ link .split ('/' )[- 1 ]} ]({ link } )\n \n Codename:\n *{ codename } *" ,
94+ parse_mode = "Markdown" ,
95+ )
96+
97+
9798def main ():
9899 dp .middleware .setup (ThrottlingMiddleware ())
99100 scheduler .add_job (
0 commit comments