dsh-tg-bridge 1.26.0 → 1.26.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/callbacks.mjs +8 -2
- package/i18n/en/core.mjs +1 -1
- package/i18n/ru/core.mjs +1 -1
- package/i18n/zh/core.mjs +1 -1
- package/package.json +1 -1
- package/progress.mjs +8 -1
- package/settings-card.mjs +7 -2
package/callbacks.mjs
CHANGED
|
@@ -358,11 +358,17 @@ export async function handleCardPress(query, ctx) {
|
|
|
358
358
|
text: card.text,
|
|
359
359
|
reply_markup: { inline_keyboard: inlineKeyboard(card.keyboard) },
|
|
360
360
|
...(threadId > 0 ? { message_thread_id: threadId } : {}),
|
|
361
|
-
}).catch((error) =>
|
|
361
|
+
}).catch((error) => {
|
|
362
|
+
const why = String(error.message || '');
|
|
363
|
+
// Tapping the tab you are already on is not a failure: Telegram refuses an
|
|
364
|
+
// edit that changes nothing, and the card is already what the press asked
|
|
365
|
+
// for. Logging it as a failure made a working tap look broken.
|
|
366
|
+
if (!/message is not modified/i.test(why)) log(`settings card redraw failed: ${why}`);
|
|
367
|
+
});
|
|
362
368
|
await tg('answerCallbackQuery', { callback_query_id: query.id }).catch(() => {});
|
|
363
369
|
};
|
|
364
370
|
|
|
365
|
-
if (wanted.
|
|
371
|
+
if (wanted.tab) {
|
|
366
372
|
await redraw(wanted.page);
|
|
367
373
|
return;
|
|
368
374
|
}
|
package/i18n/en/core.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
'status.failed': 'Turn failed',
|
|
7
7
|
'status.queued': 'queued',
|
|
8
8
|
'status.stop': 'Stop',
|
|
9
|
-
'bridge.progress.
|
|
9
|
+
'bridge.progress.topicId': 'Topic: id {n}',
|
|
10
10
|
'bridge.progress.topic': 'Topic: {name} (id {n})',
|
|
11
11
|
'settings.row.toggle': '{label}: {now}' + String.fromCharCode(10) + ' tap to get {next}. {hint}',
|
|
12
12
|
'settings.row.action': '{label}' + String.fromCharCode(10) + ' {hint}',
|
package/i18n/ru/core.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
'status.failed': 'Ход не удался',
|
|
7
7
|
'status.queued': 'в очереди',
|
|
8
8
|
'status.stop': 'Стоп',
|
|
9
|
-
'bridge.progress.
|
|
9
|
+
'bridge.progress.topicId': 'Тема: id {n}',
|
|
10
10
|
'bridge.progress.topic': 'Тема: {name} (id {n})',
|
|
11
11
|
'settings.row.toggle': '{label}: {now}' + String.fromCharCode(10) + ' нажатие — {next}. {hint}',
|
|
12
12
|
'settings.row.action': '{label}' + String.fromCharCode(10) + ' {hint}',
|
package/i18n/zh/core.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
'status.failed': '运行失败',
|
|
7
7
|
'status.queued': '排队中',
|
|
8
8
|
'status.stop': '停止',
|
|
9
|
-
'bridge.progress.
|
|
9
|
+
'bridge.progress.topicId': '话题:id {n}',
|
|
10
10
|
'bridge.progress.topic': '话题:{name}(id {n})',
|
|
11
11
|
'settings.row.toggle': '{label}: {now}' + String.fromCharCode(10) + ' 点按 → {next}。{hint}',
|
|
12
12
|
'settings.row.action': '{label}' + String.fromCharCode(10) + ' {hint}',
|
package/package.json
CHANGED
package/progress.mjs
CHANGED
|
@@ -140,7 +140,14 @@ export async function startProgress(chatId, threadId, lang = config.lang || 'en'
|
|
|
140
140
|
// is unattributable the moment it scrolls: the same 💭 line in the wrong
|
|
141
141
|
// place looks like a cross-topic bug, and half the time it is one. The
|
|
142
142
|
// name comes from Telegram, cached: one API call per topic per process.
|
|
143
|
-
|
|
143
|
+
// When the name is not there yet — the first turn after a restart always
|
|
144
|
+
// races the cache — say "id 337382" and not "тема {n}", which reads like a
|
|
145
|
+
// template that forgot to render.
|
|
146
|
+
topic: threadId
|
|
147
|
+
? (topicName(chatId, threadId)
|
|
148
|
+
? t(lang, 'bridge.progress.topic', { n: threadId, name: topicName(chatId, threadId) })
|
|
149
|
+
: t(lang, 'bridge.progress.topicId', { n: threadId }))
|
|
150
|
+
: '',
|
|
144
151
|
seconds: Math.round((Date.now() - started) / 1000),
|
|
145
152
|
// How fast this turn is actually generating, in tokens per second. The
|
|
146
153
|
// number is the turn's average — output tokens over wall time — because
|
package/settings-card.mjs
CHANGED
|
@@ -236,11 +236,16 @@ export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
|
-
* Turn a button payload into what it stands for: `{
|
|
239
|
+
* Turn a button payload into what it stands for: `{ tab }` for a tab,
|
|
240
240
|
* `{ done: true }` for the way out, `{ command, label, page }` for a setting
|
|
241
241
|
* (what to run, what to call it in the line above the rows, and which page to
|
|
242
242
|
* redraw once it has run).
|
|
243
243
|
*
|
|
244
|
+
* The tab and the setting both need a page, and that is exactly how they got
|
|
245
|
+
* confused: a switch that carried `page` was read as "show me that page", so a
|
|
246
|
+
* press redrew an identical card and ran nothing — a dead button, with no error
|
|
247
|
+
* anywhere to say so. `tab` names the one action that only changes the view.
|
|
248
|
+
*
|
|
244
249
|
* Unknown rows and unknown values answer `null`: a button from a message written
|
|
245
250
|
* before this release is the normal case, not an error, and the caller says so in
|
|
246
251
|
* one line instead of running something half-understood.
|
|
@@ -252,7 +257,7 @@ export function commandFor({ t, current = {}, updateMode = 'check' }, data) {
|
|
|
252
257
|
// The way out is not a setting: it removes the card, which is the one action
|
|
253
258
|
// the buttons could not do while a press turned the card into a line.
|
|
254
259
|
if (row === 'done' && !value) return { done: true };
|
|
255
|
-
if (SETTINGS_PAGES.includes(row) && !value) return {
|
|
260
|
+
if (SETTINGS_PAGES.includes(row) && !value) return { tab: row };
|
|
256
261
|
const button = settingsButtons({ t, current, updateMode }).find((b) => b.id === row && (b.value || '') === value);
|
|
257
262
|
if (!button || !button.command) return null;
|
|
258
263
|
return {
|