Update API
Developmentupdate-apiUpdate API is an Agent Skill for development published in the atipugin/telegram-bot-ruby repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Parse Telegram Bot API docs and rebuild generated Ruby types and endpoints
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/atipugin/telegram-bot-ruby/blob/HEAD/.claude/skills/update-api/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/update-api, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Update generated types and API endpoints from the latest Telegram Bot API documentation.
Step 1: Check for updates
- Fetch https://core.telegram.org/bots/api-changelog and identify the most recent Bot API version and all version entries listed.
- Read
CHANGELOG.mdand find the highest Bot API version mentioned to determine which version this lib currently supports. - List all Bot API versions that are newer than the lib's current version, with a summary of changes for each.
- If the lib is already up to date, stop here and inform the user.
Step 2: Parse
Run both parse tasks to scrape the latest Telegram Bot API docs:
bundle exec rake parse:types
bundle exec rake parse:methods
Step 3: Rebuild
Before rebuilding, read the custom method files listed in Step 4 so you have a snapshot of their current content.
Regenerate Ruby source files from the parsed JSON data:
bundle exec rake rebuild:types
bundle exec rake rebuild:methods
Step 4: Restore custom methods
The rebuild overwrites type files from templates, losing hand-written methods. After rebuild, read each file below and restore the custom method if it's missing:
| File | Method to restore |
|---|---|
lib/telegram/bot/types/callback_query.rb | def to_s returning data.to_s |
lib/telegram/bot/types/message.rb | def to_s returning text.to_s |
lib/telegram/bot/types/chosen_inline_result.rb | alias to_s query |
lib/telegram/bot/types/inline_query.rb | alias to_s query |
lib/telegram/bot/types/inline_keyboard_markup.rb | def to_compact_hash that calls to_compact_hash on nested InlineKeyboardButton items |
lib/telegram/bot/types/reply_keyboard_markup.rb | def to_compact_hash that calls to_compact_hash on nested KeyboardButton items |
lib/telegram/bot/types/update.rb | def current_message that finds the first non-update_id attribute value |
For each file:
- Read the current file content
- Check if the custom method/alias is already present
- If missing, add it back before the closing
endof the class, with one blank line before it
Step 5: Review changes
Run git diff --stat and then git diff to review all changes. Summarize what was added/modified/removed compared to the previous version.
Step 6: Lint and test
Run linting and tests to verify everything is correct:
bundle exec rubocop
bundle exec rake spec
If rubocop or tests fail, fix the issues before finishing.