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
This commit is contained in:
@@ -321,7 +321,23 @@ async def cmd_help(update: Update, ctx: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
"/delete <id> — delete bounty\n"
|
||||
"/track <id> — track a bounty (groups only)\n"
|
||||
"/untrack <id> — 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))
|
||||
|
||||
Reference in New Issue
Block a user