feat: add conversational Telegram AI chat
This commit is contained in:
@@ -109,14 +109,18 @@ async function fetchBotUpdates() {
|
||||
return { error: result?.description || 'Bot API request failed' };
|
||||
}
|
||||
|
||||
const messages = result.result
|
||||
.map(u => u.message || u.channel_post || u.edited_channel_post)
|
||||
.filter(Boolean)
|
||||
.map(compactBotMessage);
|
||||
const messages = extractBotChannelMessages(result.result);
|
||||
|
||||
return { messages, count: messages.length };
|
||||
}
|
||||
|
||||
export function extractBotChannelMessages(updates = []) {
|
||||
return updates
|
||||
.map(update => update.channel_post || update.edited_channel_post)
|
||||
.filter(Boolean)
|
||||
.map(compactBotMessage);
|
||||
}
|
||||
|
||||
// ─── Web preview scraping fallback ──────────────────────────────────────────
|
||||
|
||||
// Fetch raw HTML from a URL (safeFetch truncates non-JSON to 500 chars, too short)
|
||||
|
||||
Reference in New Issue
Block a user