debug: check for 'result' wrapper in Telegram API response
This commit is contained in:
@@ -58,14 +58,18 @@ export async function sendStreamingMessage(ctx, text, options = {}) {
|
||||
// Send initial placeholder message using ctx.api.sendMessage directly
|
||||
const sentMsg = await ctx.api.sendMessage(ctx.chat.id, '⌨️ ⌨️', { parse_mode: 'Markdown' });
|
||||
|
||||
// Log response structure
|
||||
// Log response structure - try to understand the format
|
||||
logger.info('📡 Response typeof:', typeof sentMsg);
|
||||
logger.info('📡 Response keys:', Object.keys(sentMsg || {}).join(', '));
|
||||
logger.info('📡 sentMsg keys:', sentMsg ? Object.keys(sentMsg).join(', ') : 'null');
|
||||
logger.info('📡 sentMsg:', JSON.stringify(sentMsg).substring(0, 300));
|
||||
|
||||
// The response might be wrapped in a 'result' property
|
||||
const response = sentMsg?.result || sentMsg;
|
||||
logger.info('📡 Response type:', typeof response);
|
||||
logger.info('📡 Response keys:', Object.keys(response || {}).join(', '));
|
||||
|
||||
// Try different access patterns
|
||||
const messageId = sentMsg?.['message_id'] || sentMsg?.message_id || sentMsg?.[0]?.['message_id'];
|
||||
const chatId = sentMsg?.['chat']?.['id'] || sentMsg?.chat?.id || sentMsg?.[0]?.['chat']?.['id'];
|
||||
const messageId = response?.['message_id'] || response?.message_id;
|
||||
const chatId = response?.['chat']?.['id'] || response?.chat?.id;
|
||||
|
||||
logger.info('📡 Extracted Message ID:', messageId);
|
||||
logger.info('📡 Extracted Chat ID:', chatId);
|
||||
|
||||
Reference in New Issue
Block a user