--- title: Telegram Bot emoji: πŸ€– colorFrom: indigo colorTo: blue sdk: docker app_port: 7860 --- # πŸŽ“ JEE & NEET Daily Study Bot β€” CrazyLearners Edition > **Fully automated, multi-channel Telegram content bot** powered by **Gemini AI (Gemini 2.0 Flash)**. > Posts 7 unique study posts/day across multiple channels β€” with repeat prevention, interactive MCQ poll sessions, weekly branded PDF digests, and a web dashboard. πŸ”— **Join us:** [t.me/xcrazylearners](https://t.me/xcrazylearners) --- ## ✨ Feature Overview | Feature | Details | |---------|---------| | πŸ€– **Gemini AI (Gemini 2.0 Flash)** | Fast, free-tier-friendly AI with zero content filtering for academic topics | | πŸ“‘ **Multi-channel** | Unlimited channels β€” JEE Main, NEET, JEE Advanced, or custom combos | | πŸ—“οΈ **7 posts/day** | PYQ, Formula Sheet, Short Notes, Mnemonic, Concept Recap, Mock Question, Motivation | | πŸ§ͺ **MCQ Poll Sessions** | 10 interactive quiz polls per session with configurable delays | | πŸ“„ **Weekly PDF Digest** | Branded CrazyLearners PDF every Sunday β€” Short Notes + Formula Sheets compiled | | 🚫 **Repeat Prevention** | Remembers last 60 topics per channel; always picks a fresh chapter | | πŸ“Š **Coverage Stats** | See what % of syllabus each channel has covered | | ⏸️ **Per-channel Control** | Pause/resume individual channels or specific content types | | 🌐 **Web Dashboard** | Full visual admin UI hosted on Hugging Face Spaces | | πŸ’¬ **Doubt Solver** | Students can DM the bot or @mention it in groups to get AI answers | | πŸ“’ **Broadcast** | Admin can push messages to all registered users with rate limiting | | πŸ”„ **Remote Sync** | History synced to a GitHub Gist for persistence across restarts | --- ## πŸ“¦ Daily Schedule (per channel, IST) | Time | Content Type | Description | |------|-------------|-------------| | 7:00 AM | πŸ“… PYQ Question | Previous year MCQ with spoiler answer + explanation | | 9:00 AM | πŸ“ Formula Sheet | 8–12 key formulas with shortcuts and derivation hints | | 12:00 PM | πŸ“ Short Notes | 3-minute rapid revision notes | | 3:00 PM | 🧠 Mnemonic | Memory tricks and visualizations | | 6:00 PM | πŸŒ… Concept Recap | Evening summary + exam weightage tips | | 8:00 PM | 🎯 Mock Question | 3 practice MCQs with step-by-step solutions | | 10:00 PM | πŸŒ™ Motivation | Night motivation + next day's plan | | 8:00 PM (MCQ channels) | πŸ§ͺ MCQ Poll Session | 10 live quiz polls with configurable delay between each | | Every Sunday 9:00 PM | πŸ“„ Weekly PDF | Branded PDF of the week's Short Notes + Formula Sheets | Each channel gets **different content** tailored to its exam focus and subject rotation. --- ## βš™οΈ Setup Guide ### Step 1 β€” Create your Telegram Bot 1. Message **@BotFather** β†’ `/newbot` 2. Copy the **API token** ### Step 2 β€” Get Gemini API Key 1. Go to [aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey) 2. Sign up β†’ **API Keys** β†’ **Create API Key** 3. Free tier is sufficient (model: `gemini-2.0-flash`) ### Step 3 β€” Create Channels & Add Bot as Admin For each channel: 1. Create the channel in Telegram 2. **Channel Settings β†’ Administrators β†’ Add Admin** 3. Search your bot β†’ grant **Post Messages** permission ### Step 4 β€” Get Your Admin User ID Message **@userinfobot** β†’ copy your numeric ID ### Step 5 β€” Configure Environment Variables Create a `.env` file (or set in your hosting environment): ```env BOT_TOKEN=7123456789:AAF... # From @BotFather GEMINI_API_KEY=AIza... # From aistudio.google.com/app/apikey ADMIN_USER_IDS=987654321 # Comma-separated for multiple admins GIST_ID=abc123... # Optional: GitHub Gist ID for remote history sync GIST_TOKEN=ghp_... # Optional: GitHub Personal Access Token ``` ### Step 6 β€” Configure Channels (first run) Edit the `DEFAULT_CHANNELS` block in `content/config_manager.py`, or use the **Web Dashboard** after startup: ```python "jee_main": { "id": "@YourJEEMainChannel", "label": "JEE Main Daily", "exam_focus": ["JEE Main"], "subjects": ["physics", "chemistry", "maths"], "active": True, "mcq_poll_enabled": False, "footer": "🎯 Crack JEE Main 2025!\nπŸ“’ Share with your batch!", "hashtags": { "pyq": "#JEEMain #PYQ", "formula": "#Formula", ... }, }, ``` > πŸ’‘ After the first run, all config changes are saved to `data/bot_config.json` and can be edited via the Web Dashboard without touching code. ### Step 7 β€” Run ```bash pip install -r requirements.txt python bot.py ``` --- ## πŸ› οΈ Admin Commands (DM your bot) | Command | What it does | |---------|-------------| | `/start` | Admin panel β€” active channels, job count, dashboard link | | `/help` | Full admin guide | | `/status` | All scheduled jobs grouped by channel with next run time | | `/channels` | List channels; tap to pause/resume any channel | | `/preview` | Interactive: pick channel β†’ pick content type β†’ see AI preview β†’ post now | | `/preview ` | Direct preview, e.g. `/preview jee_main formula_sheet` | | `/coverage` | Chapter coverage % per channel β€” see how much syllabus has been covered | | `/stats` | Rich analytics dashboard with progress bars per subject | | `/mcq_session ` | Manually trigger a 10-poll MCQ session | | `/force_digest ` | Immediately generate and send the weekly PDF | | `/broadcast ` | Push a message to all registered users | | `/set_time ` | Change posting time, e.g. `/set_time short_notes 11:30` | | `/add_channel