fix: fit all 100 commands in Telegram menu with 40-char descriptions (#4010)
* fix: truncate skill descriptions to 100 chars in Telegram menu * fix: 40-char desc cap + 100 command limit for Telegram menu setMyCommands has an undocumented total payload size limit. 50 commands with 256-char descriptions failed, 50 with 100-char worked, and 100 with 40-char descriptions also works (~5300 total chars). Truncate skill descriptions to 40 chars in the menu picker and set cap back to 100. Full descriptions available via /commands.
This commit is contained in:
@@ -399,9 +399,10 @@ def telegram_menu_commands(max_commands: int = 100) -> tuple[list[tuple[str, str
|
||||
continue # hub-installed, not built-in
|
||||
name = cmd_key.lstrip("/").replace("-", "_")
|
||||
desc = info.get("description", "")
|
||||
# Telegram descriptions max 256 chars
|
||||
if len(desc) > 256:
|
||||
desc = desc[:253] + "..."
|
||||
# Keep descriptions short — setMyCommands has an undocumented
|
||||
# total payload limit. 40 chars fits 100 commands safely.
|
||||
if len(desc) > 40:
|
||||
desc = desc[:37] + "..."
|
||||
all_commands.append((name, desc))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user