From f7503ecd14255085719d0bd0ca26fe08b4bbcb5c Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Sat, 4 Apr 2026 06:52:23 +0000 Subject: [PATCH] feat: add /admin command to list room admins Implement /admin command as specified in issue #50: - Lists all admin user IDs for the current room - Output format: 'Room Admins:\n- @user1\n- @user2' - Shows 'No admins configured for this room.' if none exist - Available to everyone (no permission check needed) Changes: - Add cmd_admin function to commands.py - Register CommandHandler('admin', cmd_admin) in bot.py - Add /admin to command menu in post_init - Update /help to include /admin command Closes #50 --- apps/telegram-bot/bot.py | 3 +++ apps/telegram-bot/commands.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/apps/telegram-bot/bot.py b/apps/telegram-bot/bot.py index c72df9c..9604001 100644 --- a/apps/telegram-bot/bot.py +++ b/apps/telegram-bot/bot.py @@ -8,6 +8,7 @@ from telegram.ext import Application, CommandHandler, MessageHandler, filters from commands import ( cmd_add, + cmd_admin, cmd_bounty, cmd_delete, cmd_edit, @@ -41,6 +42,7 @@ def build_app() -> Application: app.add_handler(CommandHandler("delete", cmd_delete)) app.add_handler(CommandHandler("track", cmd_track)) app.add_handler(CommandHandler("untrack", cmd_untrack)) + app.add_handler(CommandHandler("admin", cmd_admin)) app.add_handler(MessageHandler(filters.COMMAND, cmd_help)) @@ -56,6 +58,7 @@ async def post_init(app: Application) -> None: ("edit", "Edit a bounty"), ("track", "Track a bounty"), ("untrack", "Stop tracking"), + ("admin", "List room admins"), ("help", "Show help"), ] ) diff --git a/apps/telegram-bot/commands.py b/apps/telegram-bot/commands.py index b0ae05e..6b9e74b 100644 --- a/apps/telegram-bot/commands.py +++ b/apps/telegram-bot/commands.py @@ -321,7 +321,23 @@ async def cmd_help(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None: "/delete — delete bounty\n" "/track — track a bounty (groups only)\n" "/untrack — stop tracking (groups only)\n" + "/admin — list room admins\n" "/start — re-initialize\n" "/help — this message", disable_web_page_preview=True, ) + + +async def cmd_admin(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None: + room_id = get_room_id(update) + admin_ids = BOUNTY_SERVICE.list_admins(room_id) + + if not admin_ids: + await update.message.reply_text("No admins configured for this room.") + return + + lines = [f"Room Admins:"] + for admin_id in admin_ids: + lines.append(f"- @{admin_id}") + + await update.message.reply_text("\n".join(lines)) -- 2.49.1