From 1c0b9ac69c5e0c214a3f068b4922b23e84f1b28f Mon Sep 17 00:00:00 2001 From: Aleksandr Pishchulev Date: Sun, 18 Oct 2026 01:03:31 +0500 Subject: [PATCH] Add /about command linking to GitHub Issues. Users can open the project issue tracker from the bot menu. Co-authored-by: Cursor --- README.md | 1 + bot/handlers/__init__.py | 3 ++- bot/handlers/about.py | 22 ++++++++++++++++++++++ bot/handlers/start.py | 3 ++- bot/main.py | 1 + tests/unit/test_about.py | 17 +++++++++++++++++ 6 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 bot/handlers/about.py create mode 100644 tests/unit/test_about.py diff --git a/README.md b/README.md index 25f8b0a..233e3f3 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ An automated Telegram bot designed to help gamers find the lowest prices for Pla | `/settings` | Display currency, tracked regions, and other preferences | | `/search` | Search for a game and compare prices across your tracked regions | | `/subscriptions` | View your subscribed games with current prices | +| `/about` | About the bot and a link to GitHub Issues | --- diff --git a/bot/handlers/__init__.py b/bot/handlers/__init__.py index 1987059..9c8d327 100644 --- a/bot/handlers/__init__.py +++ b/bot/handlers/__init__.py @@ -1,9 +1,10 @@ from aiogram import Router -from bot.handlers import ps_store_link, regions, search, settings, start, subscriptions +from bot.handlers import about, ps_store_link, regions, search, settings, start, subscriptions router = Router() router.include_router(start.router) +router.include_router(about.router) router.include_router(ps_store_link.router) router.include_router(settings.router) router.include_router(regions.router) diff --git a/bot/handlers/about.py b/bot/handlers/about.py new file mode 100644 index 0000000..461648a --- /dev/null +++ b/bot/handlers/about.py @@ -0,0 +1,22 @@ +from aiogram import Router +from aiogram.filters import Command +from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message + +router = Router() + +ISSUES_URL = "https://github.com/BlasterAlex/pricestation-bot/issues" + +_ABOUT = ( + "About\n\n" + "PriceStation tracks PS Store prices and notifies you when they drop.\n\n" + f'Bugs and ideas go to GitHub Issues.' +) + +_ABOUT_KEYBOARD = InlineKeyboardMarkup( + inline_keyboard=[[InlineKeyboardButton(text="Open Issues", url=ISSUES_URL)]] +) + + +@router.message(Command("about")) +async def cmd_about(message: Message) -> None: + await message.answer(_ABOUT, reply_markup=_ABOUT_KEYBOARD) diff --git a/bot/handlers/start.py b/bot/handlers/start.py index 78335ba..bd2350c 100644 --- a/bot/handlers/start.py +++ b/bot/handlers/start.py @@ -16,5 +16,6 @@ async def cmd_start(message: Message, session: AsyncSession) -> None: "Hi! I'm PriceStation — I track prices in the PS Store.\n\n" "/settings — display currency, regions, and preferences\n" "/search — find a game and subscribe to price drops\n" - "/subscriptions — manage your subscriptions" + "/subscriptions — manage your subscriptions\n" + "/about — about the bot and GitHub issues" ) diff --git a/bot/main.py b/bot/main.py index 1200e3c..0aeee7a 100644 --- a/bot/main.py +++ b/bot/main.py @@ -21,6 +21,7 @@ BotCommand(command="settings", description="Display currency, regions, and preferences"), BotCommand(command="search", description="Find a game and subscribe to price drops"), BotCommand(command="subscriptions", description="Manage your subscriptions"), + BotCommand(command="about", description="About the bot and GitHub issues"), ] diff --git a/tests/unit/test_about.py b/tests/unit/test_about.py new file mode 100644 index 0000000..513d99b --- /dev/null +++ b/tests/unit/test_about.py @@ -0,0 +1,17 @@ +from types import SimpleNamespace +from unittest.mock import AsyncMock + +from bot.handlers.about import ISSUES_URL, cmd_about + + +async def test_about_links_to_github_issues(): + message = SimpleNamespace(answer=AsyncMock()) + + await cmd_about(message) + + text = message.answer.await_args.args[0] + markup = message.answer.await_args.kwargs["reply_markup"] + assert ISSUES_URL in text + assert "GitHub Issues" in text + assert markup.inline_keyboard[0][0].url == ISSUES_URL + assert markup.inline_keyboard[0][0].text == "Open Issues"