@tritard/waterbrother 0.16.12 → 0.16.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/gateway.js +7 -3
package/package.json
CHANGED
package/src/gateway.js
CHANGED
|
@@ -327,8 +327,12 @@ class TelegramGateway {
|
|
|
327
327
|
throw lastError || new Error(`Telegram API ${method} failed`);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
async sendMessage(chatId, text, replyToMessageId = null, { parseMode = "HTML", disableWebPagePreview = true } = {}) {
|
|
331
|
-
const chunks = parseMode === "HTML"
|
|
330
|
+
async sendMessage(chatId, text, replyToMessageId = null, { parseMode = "HTML", disableWebPagePreview = true, rawHtml = false } = {}) {
|
|
331
|
+
const chunks = parseMode === "HTML"
|
|
332
|
+
? rawHtml
|
|
333
|
+
? [String(text || "").trim() || "(no content)"]
|
|
334
|
+
: renderTelegramChunks(text)
|
|
335
|
+
: splitLongPlainText(text);
|
|
332
336
|
const sent = [];
|
|
333
337
|
for (const chunk of chunks) {
|
|
334
338
|
const result = await this.callApi("sendMessage", {
|
|
@@ -606,7 +610,7 @@ class TelegramGateway {
|
|
|
606
610
|
}
|
|
607
611
|
|
|
608
612
|
async sendProgressMessage(chatId, replyToMessageId) {
|
|
609
|
-
const [message] = await this.sendMessage(chatId, TELEGRAM_PREVIEW_TEXT, replyToMessageId, { parseMode: "HTML" });
|
|
613
|
+
const [message] = await this.sendMessage(chatId, TELEGRAM_PREVIEW_TEXT, replyToMessageId, { parseMode: "HTML", rawHtml: true });
|
|
610
614
|
return message || null;
|
|
611
615
|
}
|
|
612
616
|
|