fix: beautiful Telegram formatting via HTML (no more raw **)
- Add markdownToHtml() converter: **bold**, *italic*, code blocks, links, headings, quotes, lists - StreamConsumer: intermediate edits stay plain text, FINAL message gets full HTML formatting - sendFormatted() now uses HTML parse_mode with fallback to stripped plain text - stripMarkdown() for plain-text fallback (no raw syntax chars) - All Telegram sends now use HTML instead of legacy Markdown mode
This commit is contained in:
@@ -9,7 +9,7 @@ import { checkEnv } from '../utils/env.js';
|
||||
import { getRTK } from '../utils/rtk.js';
|
||||
import { isDuplicate, markProcessed } from './deduplication.js';
|
||||
import { queueRequest, clearQueue, isProcessing } from './request-queue.js';
|
||||
import { sendFormatted, splitMessage, escapeMarkdown, sendStreamingMessage, StreamConsumer } from './message-sender.js';
|
||||
import { sendFormatted, splitMessage, escapeMarkdown, sendStreamingMessage, StreamConsumer, markdownToHtml } from './message-sender.js';
|
||||
import { withSelfCorrection } from './self-correction.js';
|
||||
|
||||
function buildSessionKey(chatId, threadId) {
|
||||
@@ -638,7 +638,7 @@ export async function initBot(config, api, tools, skills, agents) {
|
||||
}
|
||||
|
||||
return {
|
||||
send: (chatId, text) => bot.api.sendMessage(chatId, text, { parse_mode: 'Markdown' }),
|
||||
send: (chatId, text) => bot.api.sendMessage(chatId, markdownToHtml(text), { parse_mode: 'HTML' }),
|
||||
ws: (chatId, msg) => wsClients.get(chatId)?.send(JSON.stringify(msg)),
|
||||
waitForMessages: async () => { await new Promise(() => {}); },
|
||||
getConnections: () => wsClients.size,
|
||||
|
||||
Reference in New Issue
Block a user