commands.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import logging
  2. from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
  3. from telegram.ext import ContextTypes
  4. from .base import InfoCommandsBase
  5. logger = logging.getLogger(__name__)
  6. class CommandsInfo(InfoCommandsBase):
  7. """Handles the commands information command."""
  8. async def commands_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
  9. """Handle the /commands and /c command with quick action buttons."""
  10. chat_id = update.effective_chat.id
  11. if not self._is_authorized(update):
  12. return
  13. commands_text = """
  14. 📱 <b>Quick Commands</b>
  15. Tap any button below for instant access to bot functions:
  16. 💡 <b>Pro Tip:</b> These buttons work the same as typing the commands manually, but faster!
  17. """
  18. keyboard = [
  19. [
  20. InlineKeyboardButton("💰 Balance", callback_data="/balance"),
  21. InlineKeyboardButton("📈 Positions", callback_data="/positions")
  22. ],
  23. [
  24. InlineKeyboardButton("📋 Orders", callback_data="/orders"),
  25. InlineKeyboardButton("📊 Stats", callback_data="/stats")
  26. ],
  27. [
  28. InlineKeyboardButton("💵 Price", callback_data="/price"),
  29. InlineKeyboardButton("📊 Market", callback_data="/market")
  30. ],
  31. [
  32. InlineKeyboardButton("🏆 Performance", callback_data="/performance"),
  33. InlineKeyboardButton("🔔 Alarms", callback_data="/alarm")
  34. ],
  35. [
  36. InlineKeyboardButton("📅 Daily", callback_data="/daily"),
  37. InlineKeyboardButton("📊 Weekly", callback_data="/weekly")
  38. ],
  39. [
  40. InlineKeyboardButton("📆 Monthly", callback_data="/monthly"),
  41. InlineKeyboardButton("🔄 Trades", callback_data="/trades")
  42. ],
  43. [
  44. InlineKeyboardButton("🔄 Monitoring", callback_data="/monitoring"),
  45. InlineKeyboardButton("📝 Logs", callback_data="/logs")
  46. ],
  47. [
  48. InlineKeyboardButton("🎲 Risk", callback_data="/risk"),
  49. InlineKeyboardButton("⚙️ Help", callback_data="/help")
  50. ]
  51. ]
  52. reply_markup = InlineKeyboardMarkup(keyboard)
  53. await context.bot.send_message(chat_id=chat_id, text=commands_text, parse_mode='HTML', reply_markup=reply_markup)