A comprehensive 🤖 Telegram bot for managing OTT (Over-The-Top) streaming services. This bot allows administrators to create, extend, and delete OTT service entries, while users can claim and access these services for streaming content.
- ✨ Features
- 📋 Prerequisites
- 💾 Installation
- ⚙️ Configuration
- 🎮 Usage
- ⌨️ Commands
- 📁 File Structure
- 🔒 Security Considerations
- 📄 License
- 👥 Admin Management: Create, extend, and delete OTT service entries
- 🎁 User Claims: Users can claim OTT services via unique links
- ⏰ Expiration Tracking: Automatic tracking and notification of expiring services
- 👤 User Management: Admins can view all users and delete user records
- 📢 Announcement System: Send announcements to all registered users (text or photo)
- 🌍 Timezone Support: Uses Malaysia timezone (Asia/Kuala_Lumpur) for all dates
- 🚫 Duplicate Prevention: Prevents multiple claims of the same OTT ID
- 🔔 Reminder System: Automated reminders sent before service expiration (7, 3, and 1 day warnings)
- 🐍 Python 3.8 or higher
- 🤖 Telegram Bot Token (obtained from @BotFather)
- 📚 Required Python libraries (see Installation)
- 📁 Clone the repository or download the bot.py file
- 📦 Install the required dependencies:
pip install python-telegram-bot pytz- ✅ Make sure you have the required Python libraries installed
Before running the bot, you need to configure the following:
- 🤖 Bot Token: Replace the
BOT_TOKENin the code with your actual bot token - 👥 Admin IDs: Update the
ADMIN_IDSlist with the Telegram user IDs of administrators - 👤 Admin Usernames: Update the
ADMIN_USERNAMESdictionary with admin usernames for support contact
Example configuration:
BOT_TOKEN = "YOUR_ACTUAL_BOT_TOKEN_HERE"
ADMIN_IDS = ["123456789", "987654321"] # Replace with actual Telegram user IDs
ADMIN_USERNAMES = {
"123456789": "admin_username",
"987654321": "another_admin"
}Run the bot with:
python bot.py- 🎯 Start the bot with
/startcommand - 🔗 Use claim links (e.g.,
https://t.me/yourbot?start=claim_ott-id) to claim OTT services - 📺 Access your claimed services with the provided URLs
After starting the bot, you'll see the admin control panel with the following commands:
/create <ott_id> <duration>- Create a new OTT service entry/extend <ott_id> <duration>- Extend an existing OTT service/delete <ott_id>- Delete an OTT service entry/deleteuser <user_id>- Remove a user's record/list- View all active services/users- View all registered users/announce <message>- Send announcement to all users
To create a new OTT service:
/create rtm-41806 90days
This will create an OTT service with ID "rtm-41806" that expires in 90 days. The bot will generate a claim link that users can use to access the service.
To extend an existing OTT service:
/extend rtm-41806 30days
This will add 30 days to the current expiration date of the service.
To delete an OTT service:
/delete rtm-41806
You'll be prompted to confirm the deletion to prevent accidental removals.
/start- Start the bot and receive welcome message
/create <id> <duration>- Deploy new OTT service/extend <id> <duration>- Extend service validity/delete <id>- Remove OTT service/deleteuser <user_id>- Remove user record/list- View all active services/users- View all registered users/announce <message>- Send announcement to all users (with preview)
/create myservice-001 30days
/extend myservice-001 15days
/delete myservice-001
/deleteuser 123456789
/list
/users
/announce Hello, there's a maintenance window tomorrow!
The bot automatically creates the following directories:
📁 database/- Stores OTT service entries as JSON files📁 users/- Stores user records as JSON files📁 announcements/- Stores announcement logs
Each OTT service is stored as a JSON file named after its ID (e.g., rtm-41806.json) containing:
- 📅 Expiration timestamp
- 📆 Expiration description
- 📱 Device limit
- 📺 Playlist type
- 👷 Creator information
- 📋 Device list
Each user record is stored as a JSON file named after their user ID containing:
- 👤 User information (ID, username, first name, last name)
- 🎁 List of claimed OTT services
- 📅 Registration date
- 🔔 Reminders sent tracking
- 👮 Admin creates an OTT service using
/create - 🤖 Bot generates a unique claim link (e.g.,
https://t.me/yourbot?start=claim_service-id) - 👤 User clicks the link to claim the service
- 🤖 Bot verifies the OTT ID exists and hasn't been claimed
- 🎫 Service is linked to the user's account
- 🤖 Bot provides access URL and instructions
- 🛠️ Access management commands through the control panel
- ➕ ➖ 🔁 Create, extend, or delete services as needed
- 📊 Monitor active services and users
- 📢 Send announcements to all users
- 🤖 Bot checks for expiring services every minute
- 🔔 Sends warnings 7, 3, and 1 day before expiration
- 🚫 Prevents duplicate reminders to the same user on the same day
- 🔑 Token Security: Ensure your bot token remains secret and is not shared in public repositories
- 👥 Admin Access: Only trusted users should be added to ADMIN_IDS
- 👤 User Data: User information is stored in JSON files locally
- 🚫 Unique Claims: Each OTT ID can only be claimed by one user
- ✅ Input Validation: The bot validates inputs to prevent errors
- ⏳ Rate Limiting: Small delays are implemented when sending bulk messages
For assistance with the bot, contact the administrators listed in the configuration. 📞
This project is developed for educational and personal use. Modify according to your needs. 📝