fix: telegram not get message because beyond int i use string solve this problem
Browse files234 unmodified lines23523623723823923823924024124224324424524524624724824925025025125225325414 unmodified lines269270271272273274275276277275278279280281234 unmodified lines5165175185195205215225235241 unmodified line526527528523529530531532234 unmodified lines throw new Error('Telegram service is not running') }
const numericChatId = Number(chatId) logTelegramDebug(`[telegram] sendMessage called: chatId=${chatId} (type: ${typeof chatId}), numericChatId=${numericChatId} (type: ${typeof numericChatId}), text length=${text.length}`) // Telegram API 支持 chat_id 为字符串格式(特别是对于超出安全整数范围的 ID) // 直接使用字符串格式,避免整数溢出问题 logTelegramDebug(`[telegram] sendMessage called: chatId=${chatId} (type: ${typeof chatId}), text length=${text.length}`) logTelegramDebug(`[telegram] allowedUserIds: ${JSON.stringify(this.config.allowedUserIds)}`)
let lastMessageId: number | undefined
for (const chunk of chunkTelegramMessage(text)) { logTelegramDebug(`[telegram] sending chunk to chat_id: ${numericChatId}`) logTelegramDebug(`[telegram] sending chunk to chat_id: ${chatId}`) const response = await this.callTelegram<TelegramSendMessageResponse>( this.config, 'sendMessage', { chat_id: numericChatId, chat_id: chatId, text: chunk, ...(replyMarkup ? { reply_markup: replyMarkup } : {}), },14 unmodified lines throw new Error('Telegram service is not running') }
// Telegram API 支持 chat_id 为字符串格式(特别是对于超出安全整数范围的 ID) // 直接使用字符串格式,避免整数溢出问题 await this.callTelegram<TelegramEditMessageResponse>( this.config, 'editMessageText', { chat_id: Number(chatId), chat_id: chatId, message_id: messageId, text, ...(replyMarkup ? { reply_markup: replyMarkup } : {}),234 unmodified lines : timeoutController.signal
try { const body = JSON.stringify(payload) logTelegramDebug(`[telegram] API request body: ${body}`)
const response = await fetch( `${TELEGRAM_API_BASE}/bot${config.botToken}/${method}`, {1 unmodified line headers: { 'content-type': 'application/json', }, body: JSON.stringify(payload), body, signal: combinedSignal, }, )src/services/telegram/TelegramService.ts+12-6