How fmmagalhaes/random-reminder-telegram-bot works
This is a Telegram bot for collecting chat text and sending stored messages back as random reminders, either on demand or on a per-chat schedule. Users can also start or stop reminders, inspect stored messages, and delete one or all messages. The runtime registers Telegram command and text handlers, while a periodic job checks active chats against saved cron expressions. Message and chat configuration state is persisted locally in JSON. The source excerpts show these main flows; relationships for the documented commands and local storage are grounded in the README where applicable.
Main entry points: bot.py Bot entrypoint · chat_repository.py Chat repository · command_handlers.py Command handlers · schedule_handlers.py Schedule conversation
Components 13
Bot runtime
- Bot entrypoint
src/bot.py
Chat handlers
- Command handlers
src/handlers/command_handlers.py - Text handler
src/handlers/message_handlers.py
Scheduling
- Schedule conversation
src/handlers/schedule_handlers.py - Cron trigger check
src/helpers/time_utils.py
Shared support
- Authorization wrapper
src/helpers/auth_wrapper.py - Reminder sender
src/helpers/reminder_utils.py - Logging
src/helpers/logger.py
Persistence
- Chat repository
src/storage/chat_repository.py - Local JSON state
src/storage/chat_repository.py
Other components
- Chat user
- Telegram platform
- Natural-language cron parser
Connections 22
- Chat user → Telegram platform: sends messages
README.md - Telegram platform → Bot entrypoint: delivers updates
src/bot.py - Bot entrypoint → Command handlers: registers commands
src/bot.py - Bot entrypoint → Text handler: registers text handler
src/bot.py - Bot entrypoint → Schedule conversation: registers conversation
src/bot.py - Command handlers → Authorization wrapper: guards commands
src/handlers/command_handlers.py - Text handler → Authorization wrapper: guards messages
src/handlers/message_handlers.py - Schedule conversation → Authorization wrapper: guards schedule actions
src/handlers/schedule_handlers.py - Text handler → Chat repository: stores text
src/handlers/message_handlers.py - Command handlers → Chat repository: manages chat data
src/handlers/command_handlers.py - Command handlers → Reminder sender: requests reminder
src/handlers/command_handlers.py - Schedule conversation → Chat repository: saves schedule
src/handlers/schedule_handlers.py - Schedule conversation → Natural-language cron parser: parses schedule text
src/handlers/schedule_handlers.py - Bot entrypoint → Chat repository: reads chat schedules
src/bot.py - Bot entrypoint → Cron trigger check: checks trigger time
src/bot.py - Bot entrypoint → Reminder sender: sends due reminder
src/bot.py - Reminder sender → Chat repository: selects random message
src/helpers/reminder_utils.py - Reminder sender → Telegram platform: sends reminder
src/helpers/reminder_utils.py - Chat repository → Local JSON state: reads and writes
src/storage/chat_repository.py - Chat repository → Logging: logs storage errors
src/storage/chat_repository.py - Authorization wrapper → Logging: logs access
src/helpers/auth_wrapper.py - Bot entrypoint → Logging: configures logging
src/bot.py