How candycrimsie/aiomax2 works
aiomax2 is an asynchronous Python framework for MAX bots. The principal workflow receives updates through Long Polling or Webhook, parses them into typed MAX models, routes events through filters and middleware to application handlers, and lets handlers call Bot methods that communicate with MAX. FSM and keyboard construction are supporting capabilities. The graph uses README and SOURCE INDEX relationships; unsampled implementation details are not inferred beyond those references.
Main entry points: dispatcher.py Dispatcher · event.py Event observers · bot.py Bot API methods · message.py Message and callback models
Components 20
Update ingress
- Dispatcher
src/aiomax2/dispatcher/dispatcher.py - Webhook handler
src/aiomax2/webhook/handler.py - FastAPI adapter
src/aiomax2/webhook/fastapi.py
Event routing
- Router
src/aiomax2/dispatcher/router.py - Event observers
src/aiomax2/dispatcher/event.py - Filters
src/aiomax2/filters - Middleware
src/aiomax2/dispatcher/middleware.py - Handler invocation
src/aiomax2/dispatcher/invoke.py
MAX API client
- Bot API methods
src/aiomax2/bot.py - HTTP session
src/aiomax2/client/session.py - Rate limiter
src/aiomax2/client/rate_limiter.py
Models and bot features
- Update models
src/aiomax2/types/update.py - Message and callback models
src/aiomax2/types/message.py - Attachments and buttons
src/aiomax2/types/attachments.py - User and chat models
src/aiomax2/types/user.py
State and utilities
- FSM contexts
src/aiomax2/fsm/context.py - Memory storage
src/aiomax2/fsm/storage/memory.py - Keyboard builder
src/aiomax2/utils/keyboard.py
Other components
- Bot developer
- MAX Bot API
Connections 26
- Bot developer → Dispatcher: configures polling
README.md - Bot developer → FastAPI adapter: mounts webhook
README.md - MAX Bot API → Dispatcher: sends updates
README.md - MAX Bot API → Webhook handler: posts updates
README.md - FastAPI adapter → Webhook handler: adapts requests
src/aiomax2/webhook/fastapi.py - Webhook handler → Update models: parses payload
src/aiomax2/webhook/handler.py - Webhook handler → Dispatcher: feeds update
src/aiomax2/webhook/handler.py - Dispatcher → Bot API methods: polls updates
src/aiomax2/dispatcher/dispatcher.py - Dispatcher → Router: dispatches events
src/aiomax2/dispatcher/dispatcher.py - Router → Event observers: triggers observers
src/aiomax2/dispatcher/router.py - Router → Middleware: wraps route
src/aiomax2/dispatcher/router.py - Event observers → Filters: evaluates filters
src/aiomax2/dispatcher/event.py - Event observers → Middleware: wraps handlers
src/aiomax2/dispatcher/event.py - Event observers → Handler invocation: invokes callbacks
src/aiomax2/dispatcher/event.py - Event observers → FSM contexts: checks state
src/aiomax2/dispatcher/event.py - Dispatcher → FSM contexts: sets up FSM
src/aiomax2/dispatcher/dispatcher.py - FSM contexts → Memory storage: persists state
src/aiomax2/fsm/context.py - Bot API methods → HTTP session: sends API requests
src/aiomax2/bot.py - HTTP session → Rate limiter: uses rate limits
src/aiomax2/client/session.py - Bot API methods → MAX Bot API: calls MAX API
README.md - Bot API methods → Message and callback models: returns message models
src/aiomax2/bot.py - Message and callback models → Bot API methods: message shortcuts
src/aiomax2/types/message.py - Update models → Message and callback models: contains messages
src/aiomax2/types/update.py - Message and callback models → Attachments and buttons: models attachments
src/aiomax2/types/message.py - Message and callback models → User and chat models: models senders
src/aiomax2/types/message.py - Keyboard builder → Attachments and buttons: builds markup
src/aiomax2/utils/keyboard.py