fix: land /help + /commands formatting (#2504) (thanks @hougangdev)
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
cc1782b105
commit
2ad550abe8
@@ -6,6 +6,7 @@ Docs: https://docs.clawd.bot
|
|||||||
Status: unreleased.
|
Status: unreleased.
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
- Commands: group /help and /commands output with Telegram paging. (#2504) Thanks @hougangdev.
|
||||||
- macOS: limit project-local `node_modules/.bin` PATH preference to debug builds (reduce PATH hijacking risk).
|
- macOS: limit project-local `node_modules/.bin` PATH preference to debug builds (reduce PATH hijacking risk).
|
||||||
- Tools: add per-sender group tool policies and fix precedence. (#1757) Thanks @adam91holt.
|
- Tools: add per-sender group tool policies and fix precedence. (#1757) Thanks @adam91holt.
|
||||||
- Agents: summarize dropped messages during compaction safeguard pruning. (#2509) Thanks @jogi47.
|
- Agents: summarize dropped messages during compaction safeguard pruning. (#2509) Thanks @jogi47.
|
||||||
|
|||||||
@@ -204,47 +204,6 @@ export const registerTelegramHandlers = ({
|
|||||||
const callbackMessage = callback.message;
|
const callbackMessage = callback.message;
|
||||||
if (!data || !callbackMessage) return;
|
if (!data || !callbackMessage) return;
|
||||||
|
|
||||||
// Handle commands pagination callback
|
|
||||||
const paginationMatch = data.match(/^commands_page_(\d+|noop)$/);
|
|
||||||
if (paginationMatch) {
|
|
||||||
const pageValue = paginationMatch[1];
|
|
||||||
if (pageValue === "noop") return; // Page number button - no action
|
|
||||||
|
|
||||||
const page = parseInt(pageValue, 10);
|
|
||||||
if (isNaN(page) || page < 1) return;
|
|
||||||
|
|
||||||
const skillCommands = listSkillCommandsForAgents({ cfg });
|
|
||||||
const result = buildCommandsMessagePaginated(cfg, skillCommands, {
|
|
||||||
page,
|
|
||||||
surface: "telegram",
|
|
||||||
});
|
|
||||||
|
|
||||||
const messageId = callbackMessage.message_id;
|
|
||||||
const chatId = callbackMessage.chat.id;
|
|
||||||
const keyboard =
|
|
||||||
result.totalPages > 1
|
|
||||||
? buildInlineKeyboard(
|
|
||||||
buildCommandsPaginationKeyboard(result.currentPage, result.totalPages),
|
|
||||||
)
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await bot.api.editMessageText(
|
|
||||||
chatId,
|
|
||||||
messageId,
|
|
||||||
result.text,
|
|
||||||
keyboard ? { reply_markup: keyboard } : undefined,
|
|
||||||
);
|
|
||||||
} catch (editErr) {
|
|
||||||
// Ignore "message is not modified" errors (user clicked same page)
|
|
||||||
const errStr = String(editErr);
|
|
||||||
if (!errStr.includes("message is not modified")) {
|
|
||||||
throw editErr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const inlineButtonsScope = resolveTelegramInlineButtonsScope({
|
const inlineButtonsScope = resolveTelegramInlineButtonsScope({
|
||||||
cfg,
|
cfg,
|
||||||
accountId,
|
accountId,
|
||||||
|
|||||||
Reference in New Issue
Block a user