Skip to content

v3.7 — framework layer, robustness, API completeness

Latest

Choose a tag to compare

@wrxck wrxck released this 22 Jun 22:03
· 2 commits to main since this release

A large, fully backward-compatible release. 858 tests pass, luacheck clean. Built in five reviewed tranches, then put through a multi-agent adversarial review and an end-to-end mock-Telegram integration test before release.

Framework layer (new)

  • Command router: api.command('start', handler), guarded commands ({ guard = fn }), api.hears(pattern, handler), api.on_command_not_found(handler).
  • Rich context: api.build_context(update) with ctx.reply/reply_with_photo/answer/session/args/chat/from.
  • Sessions: per-chat/user store with pluggable backends (api.session.get/set/clear/use).
  • Conversations: api.conversation(name, fn) + api.enter(fn, update) with ctx.wait_for() — works in sync (coroutine) and async (copas mailbox) modes.

Production robustness

  • Automatic 429 / retry_after flood-control with bounded exponential backoff (async uses copas.sleep).
  • 409 conflict detection in the polling loops.
  • Webhook receiver: api.webhook.process(body, opts) for bring-your-own-server, api.webhook.serve(opts) turnkey copas server — with token verification.
  • Structured logging + metrics: api.log.{debug,info,warn,error} (configurable sink/level), api.metrics.

API completeness (Bot API 10.1)

  • 29 new methods: business accounts (12), gift lifecycle (transfer/upgrade/convert/gift-premium), stories (post/edit/delete), verification, subscription invite links, get_my_star_balance, edit_message_checklist, save_prepared_inline_message, set_user_emoji_status.
  • New builders: reaction_type_paid, reply-keyboard request buttons, input_poll_option, paid-media/story-content/profile-photo inputs, checklist builders, copy_text_button, and more.
  • direct_messages_topic_id / suggested_post_parameters added to the send/forward/copy methods.

Adapters

  • LLM tool/function calling + bounded retry + no caller-mutation; redis reconnect + scan; sqlite prepared-statement cache; email attachments.

Bug fixes

  • Poll loops pairs→ipairs (no duplicate processing); sync dispatch is now pcall-guarded; on_guest_message routed; fmt.code markdown escaping; request layer no longer mutates the caller's table; async multi-file uploads fixed; async conversation timeout fixed.

Fully backward compatible — existing on_message/on_* handlers are unchanged. Bot API 10.1.

Install: luarocks install telegram-bot-lua