debug: add send logging to sendStreamingMessage
This commit is contained in:
@@ -485,13 +485,18 @@ export class StreamConsumer {
|
||||
* @param {object} [options] - { editInterval, cursor }
|
||||
*/
|
||||
export async function sendStreamingMessage(ctx, text, options = {}) {
|
||||
if (!text) return;
|
||||
if (!text) {
|
||||
logger.warn('sendStreamingMessage called with empty text');
|
||||
return;
|
||||
}
|
||||
|
||||
const html = markdownToHtml(text);
|
||||
logger.info(`📤 Sending message (${text.length} chars, HTML ${html.length} chars)`);
|
||||
|
||||
// Try sending as formatted HTML first — most reliable
|
||||
try {
|
||||
await ctx.reply(html, { parse_mode: 'HTML' });
|
||||
const msg = await ctx.reply(html, { parse_mode: 'HTML' });
|
||||
logger.info(`✅ Message sent (msg_id: ${msg.message_id})`);
|
||||
return;
|
||||
} catch (e) {
|
||||
logger.warn(`sendStreamingMessage HTML failed (${e.message}), trying plain`);
|
||||
@@ -499,7 +504,8 @@ export async function sendStreamingMessage(ctx, text, options = {}) {
|
||||
|
||||
// Fallback: stripped plain text
|
||||
try {
|
||||
await ctx.reply(stripMarkdown(text), { parse_mode: undefined });
|
||||
const msg = await ctx.reply(stripMarkdown(text), { parse_mode: undefined });
|
||||
logger.info(`✅ Plain message sent (msg_id: ${msg.message_id})`);
|
||||
} catch (e2) {
|
||||
logger.error(`sendStreamingMessage plain also failed: ${e2.message}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user