https://github.com/sdmadhav/gamified_bot
Use this Bot in real time withi this link 👇👇
https://github.com/sdmadhav/gamified_bot
afc bash databases docker management quiz railway-app telethon user
Last synced: 3 months ago
JSON representation
Use this Bot in real time withi this link 👇👇
- Host: GitHub
- URL: https://github.com/sdmadhav/gamified_bot
- Owner: sdmadhav
- Created: 2025-06-28T09:58:24.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-06-28T11:57:10.000Z (3 months ago)
- Last Synced: 2025-06-28T12:42:22.263Z (3 months ago)
- Topics: afc, bash, databases, docker, management, quiz, railway-app, telethon, user
- Language: Python
- Homepage: https://t.me/Newmdbot
- Size: 31.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 🎮 Telethon Gamification Bot
A feature-rich Telegram bot built with Telethon that gamifies group engagement through daily quizzes, polls, points, levels, and leaderboards.
## ✨ Features
### 🎯 Core Gamification
- **Daily Quizzes** (9 AM): Earn 50 points for correct answers, 10 for participation
- **Daily Polls** (2 PM): Earn 20 points for participating
- **Evening Summaries** (7 PM): Daily leaderboard and stats
- **Points & Levels**: Level up every 500 points
- **Streak System**: Build daily activity streaks for bonuses### 🏆 Engagement Mechanics
- **Early Bird Bonus**: +20 points for first 10 daily responses
- **Real-time Feedback**: Instant DM notifications for points earned
- **Leaderboards**: Daily, weekly, and all-time rankings
- **Private Commands**: Personal stats tracking via DM### 💰 Monetization (Optional)
- **Point Packages**: Users can purchase points
- **Multiple Tiers**: $1-$15 packages available
- **Instant Delivery**: Points added immediately after purchase### 🤖 Smart Automation
- **Scheduled Activities**: Automated daily content delivery
- **Database Tracking**: Comprehensive user activity logging
- **Anti-Spam**: Prevents multiple daily submissions
- **Persistent Data**: SQLite database with full backup support## 🚀 Quick Start
### Prerequisites
- Python 3.11+
- Telegram API credentials
- Bot token from @BotFather### 1. Clone and Setup
```bash
git clone
cd telethon-gamification-bot
chmod +x setup.sh
./setup.sh
```### 2. Configure Credentials
Edit `.env` file:
```env
TELEGRAM_API_ID=12345678
TELEGRAM_API_HASH=your_api_hash_here
BOT_TOKEN=1234567890:your_bot_token_here
GROUP_CHAT_ID=-1001234567890
```### 3. Start the Bot
```bash
# Development
./start.sh# Production with Docker
./docker-deploy.sh# System service (Linux)
sudo systemctl start gamification-bot
```## 📋 Daily Schedule
| Time | Activity | Purpose |
|------|----------|---------|
| 9 AM | 🧠 Daily Quiz | Knowledge challenge + points |
| 2 PM | 📊 Quick Poll | Engagement check-in |
| 7 PM | 🏆 Daily Summary | Leaderboard + motivation |
| 12 AM | 🔄 Reset | Streak updates + new day |## 🎮 Point System
### Earning Points
| Activity | Points | Notes |
|----------|--------|-------|
| Quiz (Correct) | 50 | Daily limit: 1 |
| Quiz (Attempt) | 10 | Participation reward |
| Poll Response | 20 | Daily limit: 1 |
| Early Bird | +20 | First 10 responses |
| Invite Member | 100 | When they join & stay active |### Spending Points
- **Level Up**: Every 500 points = +1 level
- **Purchase More**: Point packages available
- **Streak Bonuses**: Multipliers for consecutive days## 💬 User Commands (Private Messages)
| Command | Function |
|---------|----------|
| `/start` | Initialize account & get welcome |
| `/stats` | View points, level, streak, rank |
| `/leaderboard` | See top 10 players |
| `/buy` | Purchase point packages |
| `/help` | List all commands |## 🏗️ Technical Architecture
### Core Components
```
main.py # Main bot logic & event handlers
database.py # SQLite database manager
config.py # Settings & game content
requirements.txt # Python dependencies
```### Database Schema
```sql
users # User profiles & stats
daily_activity # Daily engagement tracking
points_history # All point transactions
quiz_responses # Quiz answer tracking
purchases # Payment history
```### Deployment Options
```
Local: ./start.sh
Docker: ./docker-deploy.sh
Systemd: systemctl start gamification-bot
Cloud: Deploy to VPS/cloud provider
```## 🔧 Configuration
### Quiz Content
Add questions in `config.py`:
```python
QUIZ_QUESTIONS = [
{
'question': "Your question here?",
'options': ["A", "B", "C", "D"],
'correct_answer': 0 # Index of correct option
}
]
```### Poll Topics
Customize polls in `config.py`:
```python
POLL_OPTIONS = [
{
'question': "How's your day?",
'options': ["Great 😄", "Good 😊", "Okay 😐", "Bad 😔"]
}
]
```### Point Packages
Modify pricing in `config.py`:
```python
POINT_PACKAGES = {
'small': {'points': 100, 'price': 1.00}
}
```## 📊 Monitoring & Management
### Real-time Monitoring
```bash
./monitor.sh # Live dashboard
./monitor.sh status # Bot status only
./monitor.sh logs # Recent logs only
```### Backup & Recovery
```bash
./backup.sh # Create database backup
# Automatic cleanup of old backups (7+ days)
```### Log Management
```
logs/bot.log # Main application logs
logs/error.log # Error tracking
data/ # Database & persistent data
```## 🐳 Docker Deployment
### Quick Deploy
```bash
# Build and start
./docker-deploy.sh# Manual commands
docker-compose up -d
docker-compose logs -f
docker-compose down
```### Container Management
```bash
# View logs
docker-compose logs gamification-bot# Access container
docker-compose exec gamification-bot bash# Update bot
docker-compose pull && docker-compose up -d
```## 🔒 Security Best Practices
### Environment Variables
```bash
# Never commit .env to version control
echo ".env" >> .gitignore# Use strong passwords for database
# Rotate API keys regularly
# Monitor access logs
```### Database Security
```bash
# Regular backups
# Encrypt sensitive data
# Limit database access
# Monitor unusual activity
```## 📈 Scaling & Performance
### Optimization Tips
- **Database**: Use indexes for queries
- **Scheduling**: Optimize job timing
- **Memory**: Monitor bot memory usage
- **Rate Limits**: Respect Telegram limits### High-Traffic Setup
```python
# Use PostgreSQL for heavy loads
# Implement caching layer