Trial Period Bot
Trial Period Bot
Telegram bot for managing the trial period (8 days) in the work chat and study group.
Capabilities
• Tracking the trial period from the moment of joining
• Controlling two chats simultaneously
• Notifications to admins about the trial expiration and user exits
• Checking attendance in both chats
• Admin panel in Telegram
• SQLite database
• Scheduler for regular checks
Installation
git clone https://github.com/yourusername/trial-period-bot.git
cd trial-period-bot
pip install -r requirements.txt
Create .env:
BOT_TOKEN=your_bot_token
WORK_CHAT_ID=-100xxxxxxxxxx
STUDY_GROUP_ID=-100yyyyyyyyyy
TRIAL_MINUTES=11520
Add the first admin:
python add_admin.py YOUR_TELEGRAM_ID
Launch
python main.py
How to get data
• Token: @BotFather → /newbot
• Chat IDs: add @userinfobot to the chat, forward a message
• Your ID: message @userinfobot → /start
Admin panel
Users:
• Export list
• List on trial
• Check attendance
• Remove participant
• Skip trial (early approval)
Administrators:
• Add / remove
• List of admins
Automatic functions
Upon joining:
• Auto-approval of application
• Adding to the database
• Starting the 8-day trial
Monitoring:
• 24 hours before — warning to admins
• Upon completion — notification with "Keep / Kick" buttons
Upon exit:
• Status update
• Notification to admins
• Auto-removal from the study group upon exit from the work chat
Project structure
trial-period-bot/
├── main.py # Entry point
├── config.py # Configuration
├── database.py # Database operations
├── scheduler.py # Task scheduler
├── keyboards.py # Bot keyboards
├── utils.py # Utility functions
├── add_admin.py # Admin addition script
├── handlers/
│ ├── chat_events.py # Chat event handling
│ ├── menu_handlers.py # Menu button handling
│ ├── admin_handlers.py # Admin operations
│ └── callback_handlers.py # Inline buttons
├── .env # Environment variables
├── bot.db # Database (created automatically)
└── requirements.txt # Dependencies
Database
users: telegram_id, name, username, join_date, trial_end_date, status (trial/approved), in_work_chat, in_study_group, notified_one_day
admins: telegram_id
Bot requirements
The bot must be an admin in both chats with permissions to:
• invite users
• ban/kick
• view participants
Deployment
Systemd:
Create /etc/systemd/system/trial-bot.service with ExecStart pointing to main.py, Restart=always
sudo systemctl enable --now trial-bot
Docker:
docker-compose up -d
Troubleshooting
• Bot not responding → token, blocking, internet
• Applications not approved → bot permissions, are applications enabled in the chat
• No notifications → check the admin list and logs
Technologies
Python 3.8+, aiogram 3.15.0, APScheduler 3.10.4, SQLite
License
GNU GPL v3.0
GitHub: https://github.com/yourusername/trial-period-bot
If useful — a star is appreciated.
Telegram bot for managing the trial period (8 days) in the work chat and study group.
Capabilities
• Tracking the trial period from the moment of joining
• Controlling two chats simultaneously
• Notifications to admins about the trial expiration and user exits
• Checking attendance in both chats
• Admin panel in Telegram
• SQLite database
• Scheduler for regular checks
Installation
git clone https://github.com/yourusername/trial-period-bot.git
cd trial-period-bot
pip install -r requirements.txt
Create .env:
BOT_TOKEN=your_bot_token
WORK_CHAT_ID=-100xxxxxxxxxx
STUDY_GROUP_ID=-100yyyyyyyyyy
TRIAL_MINUTES=11520
Add the first admin:
python add_admin.py YOUR_TELEGRAM_ID
Launch
python main.py
How to get data
• Token: @BotFather → /newbot
• Chat IDs: add @userinfobot to the chat, forward a message
• Your ID: message @userinfobot → /start
Admin panel
Users:
• Export list
• List on trial
• Check attendance
• Remove participant
• Skip trial (early approval)
Administrators:
• Add / remove
• List of admins
Automatic functions
Upon joining:
• Auto-approval of application
• Adding to the database
• Starting the 8-day trial
Monitoring:
• 24 hours before — warning to admins
• Upon completion — notification with "Keep / Kick" buttons
Upon exit:
• Status update
• Notification to admins
• Auto-removal from the study group upon exit from the work chat
Project structure
trial-period-bot/
├── main.py # Entry point
├── config.py # Configuration
├── database.py # Database operations
├── scheduler.py # Task scheduler
├── keyboards.py # Bot keyboards
├── utils.py # Utility functions
├── add_admin.py # Admin addition script
├── handlers/
│ ├── chat_events.py # Chat event handling
│ ├── menu_handlers.py # Menu button handling
│ ├── admin_handlers.py # Admin operations
│ └── callback_handlers.py # Inline buttons
├── .env # Environment variables
├── bot.db # Database (created automatically)
└── requirements.txt # Dependencies
Database
users: telegram_id, name, username, join_date, trial_end_date, status (trial/approved), in_work_chat, in_study_group, notified_one_day
admins: telegram_id
Bot requirements
The bot must be an admin in both chats with permissions to:
• invite users
• ban/kick
• view participants
Deployment
Systemd:
Create /etc/systemd/system/trial-bot.service with ExecStart pointing to main.py, Restart=always
sudo systemctl enable --now trial-bot
Docker:
docker-compose up -d
Troubleshooting
• Bot not responding → token, blocking, internet
• Applications not approved → bot permissions, are applications enabled in the chat
• No notifications → check the admin list and logs
Technologies
Python 3.8+, aiogram 3.15.0, APScheduler 3.10.4, SQLite
License
GNU GPL v3.0
GitHub: https://github.com/yourusername/trial-period-bot
If useful — a star is appreciated.