OpenParable
Skip to content
← Back to skills

Update API

Development
update-api

Update 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

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
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

  1. Fetch https://core.telegram.org/bots/api-changelog and identify the most recent Bot API version and all version entries listed.
  2. Read CHANGELOG.md and find the highest Bot API version mentioned to determine which version this lib currently supports.
  3. List all Bot API versions that are newer than the lib's current version, with a summary of changes for each.
  4. 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:

FileMethod to restore
lib/telegram/bot/types/callback_query.rbdef to_s returning data.to_s
lib/telegram/bot/types/message.rbdef to_s returning text.to_s
lib/telegram/bot/types/chosen_inline_result.rbalias to_s query
lib/telegram/bot/types/inline_query.rbalias to_s query
lib/telegram/bot/types/inline_keyboard_markup.rbdef to_compact_hash that calls to_compact_hash on nested InlineKeyboardButton items
lib/telegram/bot/types/reply_keyboard_markup.rbdef to_compact_hash that calls to_compact_hash on nested KeyboardButton items
lib/telegram/bot/types/update.rbdef current_message that finds the first non-update_id attribute value

For each file:

  1. Read the current file content
  2. Check if the custom method/alias is already present
  3. If missing, add it back before the closing end of 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.