dsh-tg-bridge 1.8.0 → 1.8.1
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/bridge.mjs +6 -3
- package/package.json +1 -1
package/bridge.mjs
CHANGED
|
@@ -1013,16 +1013,19 @@ async function startProgress(chatId, threadId, lang = 'ru') {
|
|
|
1013
1013
|
});
|
|
1014
1014
|
};
|
|
1015
1015
|
|
|
1016
|
-
/** Send or edit the panel; a rejected parse
|
|
1016
|
+
/** Send or edit the panel; `plainText` and a rejected parse fall back to text. */
|
|
1017
1017
|
const post = async (method, payload, view, keyboard = undefined) => {
|
|
1018
|
-
const
|
|
1018
|
+
const markup = config.plainText !== true;
|
|
1019
|
+
const body = markup
|
|
1020
|
+
? { ...payload, text: view.html, parse_mode: 'HTML' }
|
|
1021
|
+
: { ...payload, text: view.plain };
|
|
1019
1022
|
if (keyboard !== undefined) body.reply_markup = keyboard ?? { inline_keyboard: [] };
|
|
1023
|
+
if (!markup) return tg(method, body);
|
|
1020
1024
|
try {
|
|
1021
1025
|
return await tg(method, body);
|
|
1022
1026
|
} catch (error) {
|
|
1023
1027
|
log(`${method} html failed (${String(error.message).slice(0, 100)}); retrying as plain text`);
|
|
1024
1028
|
const plain = { ...payload, text: view.plain };
|
|
1025
|
-
delete plain.parse_mode;
|
|
1026
1029
|
if (keyboard !== undefined) plain.reply_markup = keyboard ?? { inline_keyboard: [] };
|
|
1027
1030
|
return tg(method, plain);
|
|
1028
1031
|
}
|
package/package.json
CHANGED