fix(07-06): root-cause the /cari menu defect — register-commands.mjs sent the wrong Bot API field name
- the Bot API parameter is 'scope' (verified against core.telegram.org/bots/api/methods/setmycommands); the script's 'bot_command_scope' was an unknown field Telegram silently ignores, so every call hit the default scope and the two clear calls wiped the default set entirely — the ok:true lines proved nothing about scope - registration re-run: default (agnostic/en/ms) + all_private_chats (agnostic/ms) read back help, privacy, cari via getMyCommands with the correct 'scope' param; group scopes verified cleared - docs/KNOWN-LIMITATIONS.md: the 'Telegram-side defect' attribution corrected to the actual script bug; residual client menu-caching caveat + type-the-command workaround kept - bot/README.md command row updated to the real scope set
This commit is contained in:
@@ -75,18 +75,26 @@ function menuFor(locale) {
|
||||
* from-menu incident). The script therefore arms every scope it may shadow:
|
||||
* default (en) · default+ms · all_private_chats (en) · all_private_chats+ms
|
||||
* and CLEARS the group scopes (leftover phase-2 experiments) so no junk set
|
||||
* shadows anything elsewhere. ————— */
|
||||
* shadows anything elsewhere.
|
||||
*
|
||||
* GATE-BUG FIX (07-06 canary, 2026-10-25): the Bot API parameter is `scope`
|
||||
* (https://core.telegram.org/bots/api/methods/setmycommands) — this script
|
||||
* previously sent `bot_command_scope`, an unknown field Telegram SILENTLY
|
||||
* ignores, so every call actually hit the default scope and the two "clear"
|
||||
* calls wiped the default set entirely (the true root cause of the /cari
|
||||
* menu defect; the setMyCommands ok:true lines proved nothing about scope).
|
||||
* ————— */
|
||||
|
||||
const API = `https://api.telegram.org/bot${token}/setMyCommands`;
|
||||
const JSON_HEADERS = { "content-type": "application/json" };
|
||||
|
||||
const CALLS = [
|
||||
{ label: "default (en)", body: { commands: menuFor("en"), bot_command_scope: { type: "default" } } },
|
||||
{ label: "default (ms)", body: { commands: menuFor("ms"), bot_command_scope: { type: "default" }, language_code: "ms" } },
|
||||
{ label: "all_private_chats (en)", body: { commands: menuFor("en"), bot_command_scope: { type: "all_private_chats" } } },
|
||||
{ label: "all_private_chats (ms)", body: { commands: menuFor("ms"), bot_command_scope: { type: "all_private_chats" }, language_code: "ms" } },
|
||||
{ label: "clear all_group_chats", body: { commands: [], bot_command_scope: { type: "all_group_chats" } } },
|
||||
{ label: "clear all_chat_administrators", body: { commands: [], bot_command_scope: { type: "all_chat_administrators" } } },
|
||||
{ label: "default (en)", body: { commands: menuFor("en"), scope: { type: "default" } } },
|
||||
{ label: "default (ms)", body: { commands: menuFor("ms"), scope: { type: "default" }, language_code: "ms" } },
|
||||
{ label: "all_private_chats (en)", body: { commands: menuFor("en"), scope: { type: "all_private_chats" } } },
|
||||
{ label: "all_private_chats (ms)", body: { commands: menuFor("ms"), scope: { type: "all_private_chats" }, language_code: "ms" } },
|
||||
{ label: "clear all_group_chats", body: { commands: [], scope: { type: "all_group_chats" } } },
|
||||
{ label: "clear all_chat_administrators", body: { commands: [], scope: { type: "all_chat_administrators" } } },
|
||||
];
|
||||
|
||||
let failed = null;
|
||||
|
||||
Reference in New Issue
Block a user