|
@@ -26,8 +26,9 @@ class InfoCommands:
|
|
|
|
|
|
async def balance_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /balance command."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
balance = self.trading_engine.get_balance()
|
|
@@ -93,14 +94,15 @@ class InfoCommands:
|
|
|
balance_text += f" 💵 Initial: ${initial_balance:,.2f}\n"
|
|
|
balance_text += f" {pnl_emoji} P&L: ${pnl:,.2f} ({pnl_percent:+.2f}%)\n"
|
|
|
|
|
|
- await update.message.reply_text(balance_text, parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=balance_text, parse_mode='HTML')
|
|
|
else:
|
|
|
- await update.message.reply_text("❌ Could not fetch balance information")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not fetch balance information")
|
|
|
|
|
|
async def positions_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /positions command."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
positions = self.trading_engine.get_positions()
|
|
@@ -168,14 +170,15 @@ class InfoCommands:
|
|
|
positions_text += "📭 No open positions\n\n"
|
|
|
positions_text += "💡 Use /long or /short to open a position"
|
|
|
|
|
|
- await update.message.reply_text(positions_text, parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=positions_text, parse_mode='HTML')
|
|
|
else:
|
|
|
- await update.message.reply_text("❌ Could not fetch positions")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not fetch positions")
|
|
|
|
|
|
async def orders_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /orders command."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
orders = self.trading_engine.get_orders()
|
|
@@ -216,14 +219,15 @@ class InfoCommands:
|
|
|
orders_text += "📭 No open orders\n\n"
|
|
|
orders_text += "💡 Use /long, /short, /sl, or /tp to create orders"
|
|
|
|
|
|
- await update.message.reply_text(orders_text, parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=orders_text, parse_mode='HTML')
|
|
|
else:
|
|
|
- await update.message.reply_text("❌ Could not fetch orders")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not fetch orders")
|
|
|
|
|
|
async def stats_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /stats command."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
# Get current balance for stats
|
|
@@ -235,25 +239,26 @@ class InfoCommands:
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if stats:
|
|
|
stats_message = stats.format_stats_message(current_balance)
|
|
|
- await update.message.reply_text(stats_message, parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=stats_message, parse_mode='HTML')
|
|
|
else:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
|
|
|
async def trades_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /trades command."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if not stats:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
return
|
|
|
|
|
|
recent_trades = stats.get_recent_trades(10)
|
|
|
|
|
|
if not recent_trades:
|
|
|
- await update.message.reply_text("📝 No trades recorded yet.")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="📝 No trades recorded yet.")
|
|
|
return
|
|
|
|
|
|
trades_text = "🔄 <b>Recent Trades</b>\n\n"
|
|
@@ -266,12 +271,13 @@ class InfoCommands:
|
|
|
trades_text += f" 💰 ${trade['price']:,.2f} | 💵 ${trade['value']:,.2f}\n"
|
|
|
trades_text += f" 📅 {timestamp}\n\n"
|
|
|
|
|
|
- await update.message.reply_text(trades_text, parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=trades_text, parse_mode='HTML')
|
|
|
|
|
|
async def market_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /market command."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
# Get token from arguments or use default
|
|
@@ -316,14 +322,15 @@ class InfoCommands:
|
|
|
⏰ <b>Last Updated:</b> {datetime.now().strftime('%H:%M:%S')}
|
|
|
"""
|
|
|
|
|
|
- await update.message.reply_text(market_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=market_text.strip(), parse_mode='HTML')
|
|
|
else:
|
|
|
- await update.message.reply_text(f"❌ Could not fetch market data for {token}")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=f"❌ Could not fetch market data for {token}")
|
|
|
|
|
|
async def price_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /price command."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
# Get token from arguments or use default
|
|
@@ -353,14 +360,15 @@ class InfoCommands:
|
|
|
⏰ {datetime.now().strftime('%H:%M:%S')}
|
|
|
"""
|
|
|
|
|
|
- await update.message.reply_text(price_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=price_text.strip(), parse_mode='HTML')
|
|
|
else:
|
|
|
- await update.message.reply_text(f"❌ Could not fetch price for {token}")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=f"❌ Could not fetch price for {token}")
|
|
|
|
|
|
async def performance_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /performance command to show token performance ranking or detailed stats."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
try:
|
|
@@ -368,27 +376,27 @@ class InfoCommands:
|
|
|
if context.args and len(context.args) >= 1:
|
|
|
# Detailed performance for specific token
|
|
|
token = context.args[0].upper()
|
|
|
- await self._show_token_performance(update, token)
|
|
|
+ await self._show_token_performance(chat_id, token, context)
|
|
|
else:
|
|
|
# Show token performance ranking
|
|
|
- await self._show_performance_ranking(update)
|
|
|
+ await self._show_performance_ranking(chat_id, context)
|
|
|
|
|
|
except Exception as e:
|
|
|
error_message = f"❌ Error processing performance command: {str(e)}"
|
|
|
- await update.message.reply_text(error_message)
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=error_message)
|
|
|
logger.error(f"Error in performance command: {e}")
|
|
|
|
|
|
- async def _show_performance_ranking(self, update: Update):
|
|
|
+ async def _show_performance_ranking(self, chat_id: str, context: ContextTypes.DEFAULT_TYPE):
|
|
|
"""Show token performance ranking (compressed view)."""
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if not stats:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
return
|
|
|
|
|
|
token_performance = stats.get_token_performance()
|
|
|
|
|
|
if not token_performance:
|
|
|
- await update.message.reply_text(
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=
|
|
|
"📊 <b>Token Performance</b>\n\n"
|
|
|
"📭 No trading data available yet.\n\n"
|
|
|
"💡 Performance tracking starts after your first completed trades.\n"
|
|
@@ -444,20 +452,20 @@ class InfoCommands:
|
|
|
|
|
|
performance_text += f"💡 <b>Usage:</b> <code>/performance BTC</code> for detailed {Config.DEFAULT_TRADING_TOKEN} stats"
|
|
|
|
|
|
- await update.message.reply_text(performance_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=performance_text.strip(), parse_mode='HTML')
|
|
|
|
|
|
- async def _show_token_performance(self, update: Update, token: str):
|
|
|
+ async def _show_token_performance(self, chat_id: str, token: str, context: ContextTypes.DEFAULT_TYPE):
|
|
|
"""Show detailed performance for a specific token."""
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if not stats:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
return
|
|
|
|
|
|
token_stats = stats.get_token_detailed_stats(token)
|
|
|
|
|
|
# Check if token has any data
|
|
|
if token_stats.get('total_trades', 0) == 0:
|
|
|
- await update.message.reply_text(
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=
|
|
|
f"📊 <b>{token} Performance</b>\n\n"
|
|
|
f"📭 No trading history found for {token}.\n\n"
|
|
|
f"💡 Start trading {token} with:\n"
|
|
@@ -470,7 +478,7 @@ class InfoCommands:
|
|
|
|
|
|
# Check if there's a message (no completed trades)
|
|
|
if 'message' in token_stats and token_stats.get('completed_trades', 0) == 0:
|
|
|
- await update.message.reply_text(
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=
|
|
|
f"📊 <b>{token} Performance</b>\n\n"
|
|
|
f"{token_stats['message']}\n\n"
|
|
|
f"📈 <b>Current Activity:</b>\n"
|
|
@@ -525,24 +533,25 @@ class InfoCommands:
|
|
|
|
|
|
performance_text += f"\n🔄 Use <code>/performance</code> to see all token rankings"
|
|
|
|
|
|
- await update.message.reply_text(performance_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=performance_text.strip(), parse_mode='HTML')
|
|
|
|
|
|
async def daily_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /daily command to show daily performance stats."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
try:
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if not stats:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
return
|
|
|
|
|
|
daily_stats = stats.get_daily_stats(10)
|
|
|
|
|
|
if not daily_stats:
|
|
|
- await update.message.reply_text(
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=
|
|
|
"📅 <b>Daily Performance</b>\n\n"
|
|
|
"📭 No daily performance data available yet.\n\n"
|
|
|
"💡 Daily stats are calculated from completed trades.\n"
|
|
@@ -584,29 +593,30 @@ class InfoCommands:
|
|
|
daily_text += f" 📈 Avg Daily P&L: ${avg_daily_pnl:,.2f}\n"
|
|
|
daily_text += f" 🔄 Total Trades: {total_trades}\n"
|
|
|
|
|
|
- await update.message.reply_text(daily_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=daily_text.strip(), parse_mode='HTML')
|
|
|
|
|
|
except Exception as e:
|
|
|
error_message = f"❌ Error processing daily command: {str(e)}"
|
|
|
- await update.message.reply_text(error_message)
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=error_message)
|
|
|
logger.error(f"Error in daily command: {e}")
|
|
|
|
|
|
async def weekly_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /weekly command to show weekly performance stats."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
try:
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if not stats:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
return
|
|
|
|
|
|
weekly_stats = stats.get_weekly_stats(10)
|
|
|
|
|
|
if not weekly_stats:
|
|
|
- await update.message.reply_text(
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=
|
|
|
"📊 <b>Weekly Performance</b>\n\n"
|
|
|
"📭 No weekly performance data available yet.\n\n"
|
|
|
"💡 Weekly stats are calculated from completed trades.\n"
|
|
@@ -650,29 +660,30 @@ class InfoCommands:
|
|
|
weekly_text += f" 📭 No completed trades in the last 10 weeks\n"
|
|
|
weekly_text += f" 💡 Start trading to see weekly performance!"
|
|
|
|
|
|
- await update.message.reply_text(weekly_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=weekly_text.strip(), parse_mode='HTML')
|
|
|
|
|
|
except Exception as e:
|
|
|
error_message = f"❌ Error processing weekly command: {str(e)}"
|
|
|
- await update.message.reply_text(error_message)
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=error_message)
|
|
|
logger.error(f"Error in weekly command: {e}")
|
|
|
|
|
|
async def monthly_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /monthly command to show monthly performance stats."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
try:
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if not stats:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
return
|
|
|
|
|
|
monthly_stats = stats.get_monthly_stats(10)
|
|
|
|
|
|
if not monthly_stats:
|
|
|
- await update.message.reply_text(
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=
|
|
|
"📆 <b>Monthly Performance</b>\n\n"
|
|
|
"📭 No monthly performance data available yet.\n\n"
|
|
|
"💡 Monthly stats are calculated from completed trades.\n"
|
|
@@ -716,17 +727,18 @@ class InfoCommands:
|
|
|
monthly_text += f" 📭 No completed trades in the last 10 months\n"
|
|
|
monthly_text += f" 💡 Start trading to see monthly performance!"
|
|
|
|
|
|
- await update.message.reply_text(monthly_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=monthly_text.strip(), parse_mode='HTML')
|
|
|
|
|
|
except Exception as e:
|
|
|
error_message = f"❌ Error processing monthly command: {str(e)}"
|
|
|
- await update.message.reply_text(error_message)
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=error_message)
|
|
|
logger.error(f"Error in monthly command: {e}")
|
|
|
|
|
|
async def risk_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /risk command to show advanced risk metrics."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
try:
|
|
@@ -739,7 +751,7 @@ class InfoCommands:
|
|
|
# Get risk metrics and basic stats
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if not stats:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
return
|
|
|
|
|
|
risk_metrics = stats.get_risk_metrics()
|
|
@@ -747,7 +759,7 @@ class InfoCommands:
|
|
|
|
|
|
# Check if we have enough data for risk calculations
|
|
|
if basic_stats['completed_trades'] < 2:
|
|
|
- await update.message.reply_text(
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=
|
|
|
"📊 <b>Risk Analysis</b>\n\n"
|
|
|
"📭 <b>Insufficient Data</b>\n\n"
|
|
|
f"• Current completed trades: {basic_stats['completed_trades']}\n"
|
|
@@ -834,23 +846,24 @@ class InfoCommands:
|
|
|
🔄 Use /stats for trading performance metrics
|
|
|
"""
|
|
|
|
|
|
- await update.message.reply_text(risk_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=risk_text.strip(), parse_mode='HTML')
|
|
|
|
|
|
except Exception as e:
|
|
|
error_message = f"❌ Error processing risk command: {str(e)}"
|
|
|
- await update.message.reply_text(error_message)
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=error_message)
|
|
|
logger.error(f"Error in risk command: {e}")
|
|
|
|
|
|
async def balance_adjustments_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /balance_adjustments command to show deposit/withdrawal history."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
try:
|
|
|
stats = self.trading_engine.get_stats()
|
|
|
if not stats:
|
|
|
- await update.message.reply_text("❌ Could not load trading statistics")
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Could not load trading statistics")
|
|
|
return
|
|
|
|
|
|
# Get balance adjustments summary
|
|
@@ -860,7 +873,7 @@ class InfoCommands:
|
|
|
all_adjustments = stats.data.get('balance_adjustments', [])
|
|
|
|
|
|
if not all_adjustments:
|
|
|
- await update.message.reply_text(
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=
|
|
|
"💰 <b>Balance Adjustments</b>\n\n"
|
|
|
"📭 No deposits or withdrawals detected yet.\n\n"
|
|
|
"💡 The bot automatically monitors for deposits and withdrawals\n"
|
|
@@ -915,17 +928,18 @@ class InfoCommands:
|
|
|
⏰ <b>Last Check:</b> {adjustments_summary['last_adjustment'][:16] if adjustments_summary['last_adjustment'] else 'Never'}
|
|
|
"""
|
|
|
|
|
|
- await update.message.reply_text(adjustments_text.strip(), parse_mode='HTML')
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=adjustments_text.strip(), parse_mode='HTML')
|
|
|
|
|
|
except Exception as e:
|
|
|
error_message = f"❌ Error processing balance adjustments command: {str(e)}"
|
|
|
- await update.message.reply_text(error_message)
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=error_message)
|
|
|
logger.error(f"Error in balance_adjustments command: {e}")
|
|
|
|
|
|
async def commands_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /commands and /c command with quick action buttons."""
|
|
|
- if not self._is_authorized(update.effective_chat.id):
|
|
|
- await update.message.reply_text("❌ Unauthorized access.")
|
|
|
+ chat_id = update.effective_chat.id
|
|
|
+ if not self._is_authorized(chat_id):
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text="❌ Unauthorized access.")
|
|
|
return
|
|
|
|
|
|
commands_text = """
|
|
@@ -973,4 +987,4 @@ Tap any button below for instant access to bot functions:
|
|
|
]
|
|
|
reply_markup = InlineKeyboardMarkup(keyboard)
|
|
|
|
|
|
- await update.message.reply_text(commands_text, parse_mode='HTML', reply_markup=reply_markup)
|
|
|
+ await context.bot.send_message(chat_id=chat_id, text=commands_text, parse_mode='HTML', reply_markup=reply_markup)
|