fix: cap Telegram menu at 50 commands — API rejects above ~60 (#4006)

* fix: use SKILLS_DIR not repo path for Telegram menu skill filter

Skills are synced to ~/.hermes/skills/ (SKILLS_DIR), not the repo's
skills/ directory. The previous filter compared against the repo path
so no skills matched. Now checks SKILLS_DIR and excludes .hub/
subdirectory (user-installed hub skills).

* fix: cap Telegram menu at 50 commands — API rejects above ~60

Telegram's setMyCommands returns BOT_COMMANDS_TOO_MUCH when
registering close to 100 commands despite docs claiming 100 is the
limit. Metadata overhead causes rejection above ~60. Cap at 50 for
reliability — remaining commands accessible via /commands.
This commit is contained in:
Teknium
2026-03-30 11:05:20 -07:00
committed by GitHub
parent 9fd78c7a8e
commit da3e22bcfa

View File

@@ -623,7 +623,9 @@ class TelegramAdapter(BasePlatformAdapter):
try:
from telegram import BotCommand
from hermes_cli.commands import telegram_menu_commands
menu_commands, hidden_count = telegram_menu_commands(max_commands=100)
# Telegram docs say 100, but setMyCommands returns
# BOT_COMMANDS_TOO_MUCH above ~60 due to metadata overhead.
menu_commands, hidden_count = telegram_menu_commands(max_commands=50)
await self._bot.set_my_commands([
BotCommand(name, desc) for name, desc in menu_commands
])