|
@@ -44,7 +44,9 @@ class TelegramTradingBot:
|
|
|
|
|
|
def is_authorized(self, chat_id: str) -> bool:
|
|
|
"""Check if the chat ID is authorized to use the bot."""
|
|
|
- return str(chat_id) == str(Config.TELEGRAM_CHAT_ID)
|
|
|
+ authorized = str(chat_id) == str(Config.TELEGRAM_CHAT_ID)
|
|
|
+ logger.info(f"Authorization check: Incoming chat_id='{chat_id}', Configured TELEGRAM_CHAT_ID='{Config.TELEGRAM_CHAT_ID}', Authorized={authorized}")
|
|
|
+ return authorized
|
|
|
|
|
|
async def send_message(self, text: str, parse_mode: str = 'HTML') -> None:
|
|
|
"""Send a message to the authorized chat."""
|
|
@@ -105,6 +107,7 @@ class TelegramTradingBot:
|
|
|
|
|
|
async def start_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
|
|
"""Handle the /start command."""
|
|
|
+ logger.info(f"/start command triggered by chat_id: {update.effective_chat.id}")
|
|
|
if not self.is_authorized(update.effective_chat.id):
|
|
|
await update.message.reply_text("❌ Unauthorized access.")
|
|
|
return
|
|
@@ -274,16 +277,16 @@ For support or issues, check the logs or contact the administrator.
|
|
|
|
|
|
try:
|
|
|
logger.info("🚀 Initializing bot application...")
|
|
|
- await self.application.initialize()
|
|
|
+ await self.application.initialize(drop_pending_updates=True)
|
|
|
|
|
|
logger.info(f"🚀 Starting Telegram trading bot v{self.version}...")
|
|
|
|
|
|
# Send startup notification
|
|
|
await self.send_message(
|
|
|
- f"🤖 <b>Manual Trading Bot v{self.version} Started</b>\\n\\n"
|
|
|
- f"✅ Connected to Hyperliquid {'Testnet' if Config.HYPERLIQUID_TESTNET else 'Mainnet'}\\n"
|
|
|
- f"📊 Default Symbol: {Config.DEFAULT_TRADING_TOKEN}\\n"
|
|
|
- f"🔄 All systems ready!\\n\\n"
|
|
|
+ f"🤖 <b>Manual Trading Bot v{self.version} Started</b>\n\n"
|
|
|
+ f"✅ Connected to Hyperliquid {'Testnet' if Config.HYPERLIQUID_TESTNET else 'Mainnet'}\n"
|
|
|
+ f"📊 Default Symbol: {Config.DEFAULT_TRADING_TOKEN}\n"
|
|
|
+ f"🔄 All systems ready!\n\n"
|
|
|
"Use /start for quick actions or /help for all commands."
|
|
|
)
|
|
|
|