fix: skip Telegram command sync when menu is unchanged (#32017)

Hash the command list and cache it to disk per account. On restart,
compare the current hash against the cached one and skip the
deleteMyCommands + setMyCommands round-trip when nothing changed.
This prevents 429 rate-limit errors when the gateway restarts
several times in quick succession.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
scoootscooob
2026-03-02 10:58:48 -08:00
committed by Peter Steinberger
parent 4a2329e0af
commit 10fb632c9e
3 changed files with 116 additions and 2 deletions

View File

@@ -397,7 +397,7 @@ export const registerTelegramNativeCommands = ({
}
// Telegram only limits the setMyCommands payload (menu entries).
// Keep hidden commands callable by registering handlers for the full catalog.
syncTelegramMenuCommands({ bot, runtime, commandsToRegister });
syncTelegramMenuCommands({ bot, runtime, commandsToRegister, accountId });
const resolveCommandRuntimeContext = (params: {
msg: NonNullable<TelegramNativeCommandContext["message"]>;