Skip to content

๐Ÿ•๏ธ StudyCamp - Advanced Telegram bot for interactive group study sessions with live dashboards, XP system, unique invite links, and Arabic-first UI. Built with Python & SQLAlchemy.

License

Notifications You must be signed in to change notification settings

Mavdii/study-camps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

StudyCamp Bot ๐Ÿ“š

Python Telegram License Status

ุจูˆุช ุชูŠู„ูŠุฌุฑุงู… ุงุญุชุฑุงููŠ ู„ุฅุฏุงุฑุฉ ู…ุนุณูƒุฑุงุช ุงู„ุฏุฑุงุณุฉ ุงู„ุฌู…ุงุนูŠุฉ

ุงู„ุนุฑุจูŠุฉ | English


ู†ุธุฑุฉ ุนุงู…ุฉ

StudyCamp ู‡ูˆ ุจูˆุช ุชูŠู„ูŠุฌุฑุงู… ู…ุชุทูˆุฑ ู„ุฅู†ุดุงุก ูˆุฅุฏุงุฑุฉ ู…ุนุณูƒุฑุงุช ุฏุฑุงุณูŠุฉ ุชูุงุนู„ูŠุฉ ููŠ ุงู„ู…ุฌู…ูˆุนุงุช. ูŠุชู…ูŠุฒ ุงู„ุจูˆุช ุจูˆุงุฌู‡ุฉ ุนุฑุจูŠุฉ ุฌู…ูŠู„ุฉุŒ ู„ูˆุญุฉ ุชุญูƒู… ุญูŠุฉ ุชูุญุฏุซ ุชู„ู‚ุงุฆูŠุงู‹ุŒ ูˆุฑูˆุงุจุท ุฏุนูˆุฉ ูุฑูŠุฏุฉ ู„ูƒู„ ู…ุนุณูƒุฑ.

ุงู„ู…ู…ูŠุฒุงุช ุงู„ุฑุฆูŠุณูŠุฉ โœจ

  • ๐ŸŽฏ ู…ุนุงู„ุฌ ุฅู†ุดุงุก ุณู‡ู„ - 3 ุฎุทูˆุงุช ูู‚ุท: ุงู„ู…ุฏุฉ โ† ุงู„ู…ุงุฏุฉ โ† ุงู„ุชุฃูƒูŠุฏ
  • ๐Ÿ“Š ู„ูˆุญุฉ ุชุญูƒู… ุญูŠุฉ - ุชุญุฏูŠุซ ุชู„ู‚ุงุฆูŠ ูƒู„ 10 ุซูˆุงู†ู
  • ๐Ÿคฒ ุฏุนุงุก ุงู„ู…ุฐุงูƒุฑุฉ - ูŠุธู‡ุฑ ููŠ ูƒู„ ู„ูˆุญุฉ ุชุญูƒู…
  • โฑ๏ธ ุนุฏุงุฏ ุชู†ุงุฒู„ูŠ - ูŠุนุฑุถ ุงู„ูˆู‚ุช ุงู„ู…ุชุจู‚ูŠ ุจุฏู‚ุฉ
  • ๐Ÿ”— ุฑูˆุงุจุท ุฏุนูˆุฉ ูุฑูŠุฏุฉ - ู„ูƒู„ ู…ุนุณูƒุฑ ุฑุงุจุท ุฎุงุต ู„ู„ู…ุดุงุฑูƒุฉ
  • ๐Ÿ‘ฅ ุชุชุจุน ุงู„ู…ุดุงุฑูƒูŠู† - ุฅุญุตุงุฆูŠุงุช ู„ูƒู„ ู…ุดุงุฑูƒ
  • ๐Ÿ“ฑ ู…ุชุงุจุนุฉ ุฎุงุตุฉ - ุฑุณุงู„ุฉ ุฎุงุตุฉ ู„ูƒู„ ู…ุณุชุฎุฏู…

Overview

StudyCamp is a production-grade Telegram bot for running interactive study camps in group chats. Features a beautiful Arabic UI, live auto-updating dashboard, and unique invite links per camp.

Key Features โœจ

  • ๐ŸŽฏ Easy Setup Wizard - Just 3 steps: Duration โ†’ Subject โ†’ Confirm
  • ๐Ÿ“Š Live Dashboard - Auto-updates every 10 seconds
  • ๐Ÿคฒ Study Dua - Islamic prayer displayed on dashboard
  • โฑ๏ธ Countdown Timer - Precise remaining time display
  • ๐Ÿ”— Unique Invite Links - Each camp has its own shareable link
  • ๐Ÿ‘ฅ Participant Tracking - Stats for each participant
  • ๐Ÿ“ฑ Private Follow - Personal tracking message in DM

Tech Stack ๐Ÿ› ๏ธ

Component Technology
Language Python 3.11+
Bot Framework python-telegram-bot v22+ (async)
Database SQLite3 + SQLAlchemy 2.0 (aiosqlite)
Scheduling PTB JobQueue
Timezone Africa/Cairo
UI Language Arabic-first

Project Structure ๐Ÿ“

study-camps/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main.py              # Entry point
โ”‚   โ”œโ”€โ”€ config.py            # Configuration
โ”‚   โ”œโ”€โ”€ db.py                # Database setup
โ”‚   โ”œโ”€โ”€ models.py            # SQLAlchemy models
โ”‚   โ”œโ”€โ”€ handlers/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ camp_wizard.py   # Camp creation wizard
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard.py     # Live dashboard
โ”‚   โ”‚   โ”œโ”€โ”€ admin.py         # Admin controls
โ”‚   โ”‚   โ”œโ”€โ”€ tasks.py         # Task management
โ”‚   โ”‚   โ””โ”€โ”€ stats.py         # Stats & reports
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ camp_service.py      # Camp management
โ”‚   โ”‚   โ”œโ”€โ”€ session_service.py   # Study sessions
โ”‚   โ”‚   โ”œโ”€โ”€ scheduler_service.py # Job scheduling
โ”‚   โ”‚   โ””โ”€โ”€ xp_service.py        # XP system
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ markdown.py      # MarkdownV2 helpers
โ”‚       โ”œโ”€โ”€ rate_limit.py    # Rate limiting
โ”‚       โ””โ”€โ”€ logging.py       # Structured logging
โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”œโ”€โ”€ .env.example            # Environment template
โ”œโ”€โ”€ .gitignore              # Git ignore rules
โ””โ”€โ”€ README.md               # This file

Installation ๐Ÿš€

Prerequisites

  • Python 3.11 or higher
  • Telegram Bot Token (from @BotFather)

Quick Start

  1. Clone the repository
git clone https://github.com/Mavdii/study-camps.git
cd study-camps
  1. Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/macOS
# or
venv\Scripts\activate     # Windows
  1. Install dependencies
pip install -r requirements.txt
  1. Configure environment
cp .env.example .env
# Edit .env and add your BOT_TOKEN
  1. Run the bot
python -m app.main

VPS Deployment ๐Ÿ–ฅ๏ธ

Using systemd (Recommended)

  1. Upload files to your VPS
scp -r study-camps/ user@your-vps:/opt/
  1. Create systemd service
sudo nano /etc/systemd/system/studycamp.service
[Unit]
Description=StudyCamp Telegram Bot
After=network.target

[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/study-camps
Environment=BOT_TOKEN=your_bot_token_here
ExecStart=/opt/study-camps/venv/bin/python -m app.main
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
  1. Enable and start service
sudo systemctl daemon-reload
sudo systemctl enable studycamp
sudo systemctl start studycamp
  1. Check status
sudo systemctl status studycamp
sudo journalctl -u studycamp -f  # View logs

Using Docker (Alternative)

FROM python:3.11-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["python", "-m", "app.main"]
docker build -t studycamp .
docker run -d --name studycamp -e BOT_TOKEN=your_token studycamp

Bot Commands ๐Ÿค–

Command Description Scope
/start Welcome message + help All
/help Help information All
/camp Start new camp wizard Groups only
/camps Show active camps Groups only
/stop Cancel camps (Admin) Groups only
/me Personal stats All
/top Leaderboard All
/privacy Privacy policy All
/delete_me Delete user data All

Database Schema ๐Ÿ“Š

Tables

Table Description
chats Group settings and preferences
camps Study camp instances
camp_members Participants in each camp
sessions Individual study sessions
tasks Camp tasks and assignments
wizard_states Wizard flow state management

Configuration โš™๏ธ

Environment Variables

Variable Required Description
BOT_TOKEN Yes Telegram bot token from @BotFather
DATABASE_URL No SQLite path (default: sqlite+aiosqlite:///./studycamp.db)
TZ No Timezone (default: Africa/Cairo)

Dashboard Features ๐Ÿ“‹

The live dashboard displays:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿคฒ ุฏุนุงุก ุงู„ู…ุฐุงูƒุฑุฉ                   โ”‚
โ”‚  "ุงู„ู„ูŽู‘ู‡ูู…ูŽู‘ ุงู†ู’ููŽุนู’ู†ููŠ ุจูู…ูŽุง        โ”‚
โ”‚   ุนูŽู„ูŽู‘ู…ู’ุชูŽู†ููŠ ูˆูŽุนูŽู„ูู‘ู…ู’ู†ููŠ ู…ูŽุง      โ”‚
โ”‚   ูŠูŽู†ู’ููŽุนูู†ููŠ ูˆูŽุฒูุฏู’ู†ููŠ ุนูู„ู’ู…ู‹ุง"     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ“Š ู…ุนู„ูˆู…ุงุช ุงู„ู…ุนุณูƒุฑ                 โ”‚
โ”‚  โฑ๏ธ ุงู„ูˆู‚ุช ุงู„ู…ุชุจู‚ูŠ: 01:45:30        โ”‚
โ”‚  ๐Ÿ“… ุงู„ู…ุฏุฉ: ุณุงุนุชูŠู†                   โ”‚
โ”‚  ๐Ÿ‘ฅ ุงู„ู…ุดุงุฑูƒูŠู†: 5                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ”— ุฑุงุจุท ุงู„ุฏุนูˆุฉ                     โ”‚
โ”‚  t.me/bot?start=join_CODE           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  [ุงู†ุถู… ู„ู„ูƒุงู…ุจ] [ู…ุชุงุจุนุฉ ุฎุงุตุฉ]        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Contributing ๐Ÿค

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License ๐Ÿ“„

This project is licensed under the MIT License - see the LICENSE file for details.


Author ๐Ÿ‘จโ€๐Ÿ’ป

Omar El-Mahdi (Mavdi)

Telegram WhatsApp Email GitHub

Full-Stack Developer & Bot Creator


Support ๐Ÿ’ฌ

If you encounter any issues or have questions, please open an issue on GitHub.


Made with ๐Ÿ’– & โ˜• by Umar for students worldwide

Empowering minds, one study session at a time โœจ

About

๐Ÿ•๏ธ StudyCamp - Advanced Telegram bot for interactive group study sessions with live dashboards, XP system, unique invite links, and Arabic-first UI. Built with Python & SQLAlchemy.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages