Skip to content

Commit 1b8a21c

Browse files
committed
/version
1 parent 23a6a7c commit 1b8a21c

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# 0.1.2
22
- Added `/dump` `/time` `/ping` commands to the commands of the bot.
3+
- Added `/version` command and versioning of the bot.
34
# 0.1.1
45
- Added rate limit
56
- Added subscription on many applications via 1 command

bot/__main__.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from beanie import init_beanie
44

5-
from aiogram import Bot, types
5+
from aiogram import types
66
from aiogram.dispatcher import Dispatcher
77

88
from aiogram.contrib.fsm_storage.memory import MemoryStorage
@@ -11,7 +11,7 @@
1111
from aiogram.utils import executor
1212
from 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

1616
from bot.core.database import db
1717

@@ -26,14 +26,6 @@
2626

2727
scheduler = AsyncIOScheduler()
2828

29-
# storage = RedisStorage2(db=2)
30-
31-
# storage = RedisStorage2(
32-
# host="redis:/localhost",
33-
# port=6379,
34-
# db=7,
35-
# )
36-
3729
dp = 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\nSource Code:\n[denver-code/passport-status-bot/{link.split('/')[-1]}]({link})\n\nCodename:\n*{codename}*",
94+
parse_mode="Markdown",
95+
)
96+
97+
9798
def main():
9899
dp.middleware.setup(ThrottlingMiddleware())
99100
scheduler.add_job(

bot/bot_instance.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55

66
loop = asyncio.get_event_loop()
77
bot = Bot(settings.TOKEN, loop=loop)
8+
9+
version = "0.1.2"
10+
link = "https://github.com/denver-code/passport-status-bot/releases/tag/v0.1.2"
11+
codename = "Silence"

bot/controllers/start.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ async def help(message: types.Message):
5959
/policy - політика бота та конфіденційність
6060
/ping - перевірити чи працює бот
6161
/time - поточний час сервера
62+
/version - версія бота
6263
6364
*Персональні Функції:*
6465
/cabinet - персональний кабінет

0 commit comments

Comments
 (0)