From bcf5a5d1d5b3ffdd59f8d86583a747ff44eee6ed Mon Sep 17 00:00:00 2001 From: StreetLevelTech1 Date: Tue, 19 May 2026 13:22:55 +0100 Subject: [PATCH] Add tier-aware /commands handler and register command --- bot/bot.py | 2 ++ bot/handlers/__init__.py | 1 + bot/handlers/core.py | 67 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/bot/bot.py b/bot/bot.py index b2c30715..61a7869e 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -237,6 +237,7 @@ async def validate_channel(application): FREE_COMMANDS = [ BotCommand("start", "Start StrideBot"), BotCommand("help", "View all commands"), + BotCommand("commands", "View all commands by tier"), BotCommand("price", "Live crypto price"), BotCommand("top10", "Top 10 cryptos by market cap"), BotCommand("marketupdate", "Full market overview"), @@ -364,6 +365,7 @@ def main(): application.add_handler(CommandHandler("start", protected(handlers.start))) application.add_handler(CommandHandler("help", protected(handlers.help_command))) + application.add_handler(CommandHandler("commands", protected(handlers.commands))) application.add_handler(CommandHandler("clear", protected(handlers.clear))) application.add_handler(CommandHandler("price", protected(handlers.price))) diff --git a/bot/handlers/__init__.py b/bot/handlers/__init__.py index 25fedc0f..f8e2fd76 100644 --- a/bot/handlers/__init__.py +++ b/bot/handlers/__init__.py @@ -1,6 +1,7 @@ from handlers.core import ( start, help_command, + commands, clear, about, handle_message, diff --git a/bot/handlers/core.py b/bot/handlers/core.py index 1d9f18bb..34088818 100644 --- a/bot/handlers/core.py +++ b/bot/handlers/core.py @@ -705,9 +705,76 @@ async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE): "/createcoupon — Create coupon\n" "/listcoupons — View all coupons\n" ) + base += "\n\nšŸ’” Use /commands to see the full command list by tier" await safe_reply(update, base) +async def commands(update: Update, context: ContextTypes.DEFAULT_TYPE): + """List all available commands based on user tier.""" + user_id = update.effective_user.id + tier = ai.get_user_tier(user_id) + + free_cmds = ( + "šŸ†“ FREE TIER COMMANDS\n\n" + "Prices & Market\n" + "/price — Live price (e.g. /price BTC)\n" + "/top10 — Top 10 coins by market cap\n" + "/marketupdate — Full market overview\n" + "/rates — NGN exchange rates\n\n" + "News\n" + "/news — Latest crypto news (4 categories)\n\n" + "Account\n" + "/premium — Upgrade to premium\n" + "/myplan — Check your subscription\n" + "/redeem — Redeem coupon code\n" + "/clear — Clear chat history\n" + "/about — About StrideBot\n" + "/timezone — Set your timezone" + ) + + premium_cmds = ( + "\n\nšŸ’Ž PREMIUM COMMANDS\n\n" + "Analysis & Research\n" + "/analysis — Deep AI analysis\n" + "/stock — Stock price & data\n" + "/summary — AI news digest\n" + "/polymarket — Prediction market intelligence\n\n" + "Alerts & Tracking\n" + "/alert — Set price alert\n" + "/myalerts — View active alerts\n" + "/cancelalert — Remove alert\n" + "/watch — Add to watchlist (20 max)\n" + "/unwatch — Remove from watchlist\n" + "/watchlist — View watchlist with AI commentary\n\n" + "Forex & Markets\n" + "/forex — Live forex rate\n" + "/forexanalysis — AI forex analysis" + ) + + admin_cmds = ( + "\n\nšŸ‘‘ ADMIN COMMANDS\n\n" + "/broadcast — Send message to all users\n" + "/testpost — Trigger scheduled post\n" + "/stats — Bot statistics\n" + "/listusers — List all users\n" + "/addpremium — Grant premium\n" + "/removepremium — Revoke premium\n" + "/createcoupon — Create coupon\n" + "/listcoupons — View all coupons\n" + "/trending — Run trend intelligence pipeline\n" + "/approvetrend — Approve trend post for channel" + ) + + if tier == "admin": + text = free_cmds + premium_cmds + admin_cmds + elif tier in ["premium", "scheduler"]: + text = free_cmds + premium_cmds + else: + text = free_cmds + "\n\nšŸ’” Upgrade to premium for full access: /premium" + + log_event("commands_list") + await safe_reply_html(update, text) + async def clear(update: Update, context: ContextTypes.DEFAULT_TYPE): await asyncio.to_thread(db.clear_history, update.effective_user.id)