Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

---

Expand Down
3 changes: 2 additions & 1 deletion bot/handlers/__init__.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
22 changes: 22 additions & 0 deletions bot/handlers/about.py
Original file line number Diff line number Diff line change
@@ -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 = (
"<b>About</b>\n\n"
"PriceStation tracks PS Store prices and notifies you when they drop.\n\n"
f'Bugs and ideas go to <a href="{ISSUES_URL}">GitHub Issues</a>.'
)

_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)
3 changes: 2 additions & 1 deletion bot/handlers/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
1 change: 1 addition & 0 deletions bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]


Expand Down
17 changes: 17 additions & 0 deletions tests/unit/test_about.py
Original file line number Diff line number Diff line change
@@ -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"
Loading