How faramat/autopay_bot works
This is an aiogram Telegram bot for paid-channel subscriptions. Users start the bot, join a free channel, choose a subscription term, pay through RuKassa, and receive access to the private channel; scheduled checks handle subscription expiry. Admins can change prices, broadcast messages, and request database backups. The graph follows shown router registration and calls; database internals and several modules were not excerpted, so their links are limited to relationships visible in the supplied sources.
Main entry points: main.py Bot runtime · user_commands.py User commands · payments.py Payment callbacks · admin.py Admin controls
Components 19
Bot entry
- Bot runtime
main.py - User commands
handlers/user_commands.py - Channel keyboards
keyboards/inline.py - Navigation keyboards
keyboards/reply.py - Bot configuration
config.py - HTTP session
services/api_session.py
Subscription flow
- Channel callbacks
callbacks/sub_channels.py - Payment callbacks
callbacks/payments.py - Payment links
keyboards/builders.py
Persistence
- User records
data/db_user_start_bot.py - Subscription records
data/db_user_sub.py - Payment records
data/db_user_payment.py - Admin records
data/db_admin.py - SQLite database
autopay.db
Admin operations
- Admin controls
handlers/admin.py - Subscription maintenance
misc/database.py
Other components
- Telegram user
- RuKassa
- Telegram API
Connections 33
- Telegram user → Bot runtime: sends updates
main.py - Bot runtime → User commands: registers router
main.py - Bot runtime → Channel callbacks: registers router
main.py - Bot runtime → Payment callbacks: registers router
main.py - Bot runtime → Admin controls: registers router
main.py - Bot runtime → Subscription maintenance: runs checks
main.py - User commands → User records: registers users
handlers/user_commands.py - User commands → Subscription records: checks access
handlers/user_commands.py - User commands → Payment links: builds plan menu
handlers/user_commands.py - User commands → Channel keyboards: shows channel links
handlers/user_commands.py - User commands → Navigation keyboards: shows navigation
handlers/user_commands.py - User commands → Telegram API: checks membership
handlers/user_commands.py - Channel callbacks → User commands: rechecks subscription
callbacks/sub_channels.py - Channel callbacks → Channel keyboards: shows subscription link
callbacks/sub_channels.py - Payment callbacks → Payment links: creates payment link
callbacks/payments.py - Payment callbacks → Admin records: reads plan prices
callbacks/payments.py - Payment callbacks → Payment records: activates subscription
callbacks/payments.py - Payment callbacks → RuKassa: checks payment
callbacks/payments.py - Payment callbacks → Channel keyboards: offers channel access
callbacks/payments.py - Payment links → Admin records: reads plan prices
keyboards/builders.py - Payment links → RuKassa: creates payment
keyboards/builders.py - Admin controls → Admin records: updates prices
handlers/admin.py - Admin controls → User records: loads recipients
handlers/admin.py - Admin controls → Telegram API: sends broadcasts
handlers/admin.py - Admin controls → Subscription maintenance: requests backup
handlers/admin.py - Subscription maintenance → Subscription records: checks expiry
misc/database.py - Subscription maintenance → Telegram API: sends backup
misc/database.py - Bot runtime → Bot configuration: loads settings
main.py - Bot runtime → HTTP session: creates session
main.py - User records → SQLite database: stores records
- Subscription records → SQLite database: stores subscriptions
- Payment records → SQLite database: stores payments
- Admin records → SQLite database: stores admin data