| name | add-bot-adapter |
| description | Add or update YAML-driven Telegram bot adapters for musigate. Use when an agent needs to probe a new Telegram bot, classify its interaction pattern, implement or revise the adapter with minimal Python changes, and validate that the adapter works both in development and in packaged releases. |
Add Bot Adapter
Use this skill when the task is to integrate a Telegram bot into musigate.
Default approach
- Probe the real bot first.
- Prefer a YAML-only adapter.
- Touch Python only when the bot truly introduces a new response shape, selection rule, or CLI need.
- If the adapter should ship in releases, keep the packaged copy aligned.
Load references/adapter-workflow.md for the exact mapping from observed bot behavior to current musigate primitives.
Workflow
1. Probe the bot
- Start with tmp_probe_bot.py.
- Probe at least these inputs when relevant:
/start, a plain query, /search <query>, and a URL.
- Capture
text, buttons, audio, document, and the ordering of follow-up messages.
2. Classify the interaction
Choose the simplest matching pattern:
- Direct query returns an audio file.
- Query returns numbered inline buttons, then clicking one returns audio.
- Query returns text plus buttons; use the text as the displayed result list.
- Query requires replying with a number instead of clicking a button.
- Query branches on returned text or response type.
3. Prefer YAML first
4. Touch Python only when necessary
5. Validate
- Add or update tests under tests.
- Run
.\.venv\Scripts\python.exe -m pytest -q.
- Run
test --bot <name>, then real search and download commands with the new adapter.
- If the adapter is release-worthy, build a wheel and confirm the packaged adapter resolves outside the repo root.
Guardrails
- Do not replace a working similarity-based strategy with
first just to make a probe pass.
- Do not invent a new response type when
inline_buttons, text_message, audio_file, or document already model the bot correctly.
- Do not forget the packaged resource copy for release-worthy adapters.