API Reference
API Reference
This section provides detailed documentation for all the classes and methods in Gpgram.
Core Components
The core components of Gpgram are:
Bot - The main interface to the Telegram Bot API
Dispatcher - Manages the routing of updates to the appropriate handlers
Router - Organizes handlers for different types of updates
Types
Gpgram provides Pydantic models for Telegram API types:
Update - Represents an incoming update from Telegram
Message - Represents a message in Telegram
User - Represents a Telegram user or bot
Chat - Represents a chat in Telegram
CallbackQuery - Represents a callback query from an inline keyboard
Filters
Filters are used to determine whether a handler should process an update:
CommandFilter - Filters messages by command
TextFilter - Filters messages by text content
RegexFilter - Filters messages by regular expression pattern
ContentTypeFilter - Filters messages by content type
ChatTypeFilter - Filters messages by chat type
Utilities
Gpgram provides utilities for common tasks:
InlineKeyboardBuilder - Builds inline keyboards for messages
ReplyKeyboardBuilder - Builds reply keyboards for messages
Simplified Interfaces
Gpgram provides simplified interfaces for common tasks:
SimpleBot - A simplified interface for the Bot class
SimpleMessage - A simplified interface for the Message class
Handler - A simplified interface for handling updates
Button - Base class for all button types
InlineButton - Represents an inline keyboard button
KeyboardButton - Represents a keyboard button
Advanced Features
Gpgram provides advanced features for more complex bots:
Middleware - Middleware for pre and post-processing updates
Logging - Advanced logging with Loguru
Error Handling - Error handling in Gpgram
Payments
Gpgram provides support for Telegram Payments:
Invoice - Represents an invoice for payment
LabeledPrice - Represents a portion of the price for goods or services
ShippingOption - Represents a shipping option
SuccessfulPayment - Represents a successful payment