Release Notes
feat(api): add new Telegram features, button styles, and async path support
Summary by Sourcery
Add support for new Telegram API features including suggested posts, fact-check metadata, advanced gifts, button styles, and paid/quick-reply messaging options, while updating filesystem operations to use async paths and improving compiler and CI tooling.
New Features:
- Expose concrete type exports for Pyrogram types, bots, bot commands, stories, business objects, and updates to provide a stable public surface.
- Extend the Gift payment type with additional fields and support for unique gifts from new raw API types.
- Augment Message, Chat, and User models with fields for stories, paid content, fact-checking, scheduling, and verification metadata from the latest Telegram API.
- Introduce SuggestedPost, StarsAmount, and FactCheck helper types to represent new business and message metadata structures.
- Allow button types to accept a higher-level ButtonStyle enum and optional icon, with automatic conversion to KeyboardButtonStyle.
- Add rich options to message and media sending methods (schedule repeat, paid stars, quick replies, send-as, background sending, drafts, and suggested posts).
- Add helper for building InputQuickReplyShortcut objects from IDs or names.
Enhancements:
- Switch many file existence and directory operations from pathlib.Path to anyio.AsyncPath to avoid blocking the event loop in async contexts.
- Simplify and harden compiler/docs generation by using pathlib, list comprehensions, and safer directory traversal.
- Mark core TLObject and Object types as unhashable to prevent misuse in hashed collections.
- Tighten chat privileges with a flag for managing direct messages and expose additional chat/user metadata like bot verification icons and paid message pricing.
Build:
- Ensure compiler steps only run for wheel/install Hatch targets and relax some ruff lint rules while adding anyio as a runtime dependency.
CI:
- Update formatting-and-tests workflow to install pytest-asyncio alongside pytest for running async tests.
Documentation:
- Generate explicit all exports for several type submodules and adjust docs compiler to better categorize and list types and enums in the API reference.
Tests:
- Enable pytest-asyncio with function-level async loop scope in project configuration and CI, and ensure CI installs pytest-asyncio.
Chores:
- Add a script to scrape and cache Telegram API documentation metadata for constructors, methods, and types for internal compiler use.
Signed-off-by: 5hojib yesiamshojib@gmail.com
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>