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.
Files changed (2) hide show
  1. package/bridge.mjs +6 -3
  2. 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 falls back to the plain twin. */
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 body = { ...payload, text: view.html, parse_mode: 'HTML' };
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tg-bridge",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Telegram bridge for DeepSeek Harness: text, voice, photos and project-per-topic sessions without opening the desktop app",
5
5
  "type": "module",
6
6
  "main": "plugin-bridge.mjs",