Browse Source

Fix leverage command parsing in trading_commands.py to correctly handle callback data structure. Updated index references to ensure proper extraction of token and leverage values, enhancing command execution reliability.

Carles Sentis 2 days ago
parent
commit
9ca554a5fb
2 changed files with 4 additions and 4 deletions
  1. 3 3
      src/commands/trading_commands.py
  2. 1 1
      trading_bot.py

+ 3 - 3
src/commands/trading_commands.py

@@ -892,9 +892,9 @@ This action cannot be undone.
     async def _execute_leverage_callback(self, query, callback_data):
         """Execute leverage command from callback."""
         parts = callback_data.split('_')
-        if parts[1] == "yes":
-            token = parts[2]
-            leverage = int(parts[3])
+        if len(parts) > 2 and parts[2] == "yes":
+            token = parts[3]
+            leverage = int(parts[4])
             symbol = f"{token}/USDC:USDC"
             
             await query.edit_message_text(text=f"Setting leverage for {token} to {leverage}x...")

+ 1 - 1
trading_bot.py

@@ -14,7 +14,7 @@ from datetime import datetime
 from pathlib import Path
 
 # Bot version
-BOT_VERSION = "2.4.261"
+BOT_VERSION = "2.4.262"
 
 # Add src directory to Python path
 sys.path.insert(0, str(Path(__file__).parent / "src"))