๐Ÿš€ Telegram Bot - Complete Setup Guide

Color Prediction Game with Auto Messages

Har 1 minute pe Big/Small/Number automatically groups mein bhejta hai

๐Ÿ“‹ Overview & Features

Ye ek complete Telegram Broadcast Bot system hai jo color prediction game ke saath integrated hai. Har 1 minute pe automatically Big/Small/Number results groups mein bhejta hai.

๐ŸŽฏ

Color Prediction

Big, Small, Number results automatically generate aur send

โฐ

Auto Messages

Har 1 minute pe automatically messages groups mein jate hain

๐Ÿ“ข

Broadcast

Ek hi message multiple groups mein simultaneously send

๐Ÿ‘ฅ

Group Management

Auto group registration aur management

๐Ÿ”„

Cron Job

Windows Task Scheduler ya Linux Crontab support

๐ŸŽจ

Simple Admin

Easy-to-use admin panel with modern UI

โš™๏ธ Requirements

1

Server Requirements

  • PHP 7.4 ya higher
  • MySQL 5.7 ya higher
  • cURL extension enabled
  • PDO extension enabled
  • HTTPS domain (webhook ke liye)
2

Telegram Bot

  • Telegram account
  • Bot token from @BotFather
  • Bot ko groups mein add karne ki permission
3

Windows (Task Scheduler)

  • Windows 10/11
  • PHP installed aur PATH mein configured
  • Administrator access (Task Scheduler setup ke liye)

๐Ÿ—„๏ธ Database Setup

1

Create Database

phpMyAdmin mein jao aur database create karo:

Database Name: tashanw3_selimxpro
2

Import SQL Schema

SQL file run karo:

File: sql/database_schema.sql
phpMyAdmin โ†’ Import โ†’ Select File โ†’ Go
๐Ÿ’ก Note: Ye file automatically tables create karega:
  • telegram_groups - Registered groups
  • auto_messages - Scheduled messages
  • color_predictions - Game results
3

Verify Tables

Check karo ki sab tables create ho gaye hain:

SHOW TABLES;

โš™๏ธ Configuration

1

Edit Config File

File: config/config.php kholo aur update karo:

// Database Configuration
define('DB_HOST', 'localhost');
define('DB_NAME', 'tashanw3_selimxpro');
define('DB_USER', 'your_username');
define('DB_PASS', 'your_password');

// Telegram Bot Token
define('BOT_TOKEN', 'YOUR_BOT_TOKEN_HERE');

// Webhook URL
define('WEBHOOK_URL', 'https://yourdomain.com/webhook/bot.php');

// Admin Credentials
define('ADMIN_USERNAME', 'admin');
define('ADMIN_PASSWORD', 'your_strong_password');
2

Get Bot Token

  1. Telegram mein @BotFather ko message karo
  2. /newbot command send karo
  3. Bot name aur username set karo
  4. Bot token copy karo
  5. Token ko config.php mein paste karo
3

Set Webhook

Webhook setup karo (ya setup_webhook.php file use karo):

https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook?url=https://yourdomain.com/webhook/bot.php
โš ๏ธ Important: Webhook URL HTTPS hona chahiye. HTTP kaam nahi karega.

๐ŸชŸ Windows Task Scheduler Setup

1

Automatic Setup (Recommended)

  1. PowerShell ko Administrator mode mein kholo
  2. Project folder mein jao:
  3. cd "C:\Users\mdasi\OneDrive\Desktop\botcom"
  4. Setup script run karo:
  5. .\cron\setup_windows_task.ps1
  6. Ya simple double-click karo: cron\setup_windows_task.bat
โœ… Success! Task automatically create ho jayega aur har 1 minute pe run hoga.
2

Manual Setup

  1. Task Scheduler kholo: taskschd.msc
  2. "Create Basic Task" click karo
  3. Name: TelegramBotAutoMessages
  4. Trigger: Daily โ†’ Start time: abhi ka time
  5. Action: Start a program
    • Program: PHP path (e.g., C:\php\php.exe)
    • Arguments: "C:\Users\mdasi\OneDrive\Desktop\botcom\cron\send_auto_messages.php"
    • Start in: C:\Users\mdasi\OneDrive\Desktop\botcom
  6. Task properties โ†’ Triggers โ†’ Edit
    • "Repeat task every" check karo โ†’ 1 minute
    • Duration: Indefinitely
3

Verify Task

PowerShell mein check karo:

Get-ScheduledTask -TaskName "TelegramBotAutoMessages"

Manual run karne ke liye:

Start-ScheduledTask -TaskName "TelegramBotAutoMessages"

๐Ÿง Linux/Unix Cron Setup

1

Edit Crontab

crontab -e
2

Add Cron Job

Ye line add karo (har 1 minute pe run hoga):

* * * * * php /path/to/your/project/cron/send_auto_messages.php

Ya curl se (agar web accessible hai):

* * * * * curl -s https://yourdomain.com/cron/send_auto_messages.php > /dev/null
3

Verify Cron

crontab -l

๐Ÿ‘จโ€๐Ÿ’ผ Admin Panel Usage

1

Login

Browser mein kholo:

https://yourdomain.com/admin/login.php

Default credentials:

  • Username: admin
  • Password: admin123
๐Ÿ”’ Security: Production mein password zaroor change karo!
2

Dashboard Features

๐Ÿ“จ

Send Single

Ek specific group ko message bhejo

๐Ÿ“ข

Broadcast

Sab groups ko ek saath message bhejo

๐ŸŽฏ

Color Prediction

Game enable/disable karo

๐Ÿ”„

Refresh Groups

Groups list update karo

๐ŸŽฏ Color Prediction Game

1

Enable Game

  1. Admin panel mein jao: admin/auto_messages.php
  2. Groups select karo (ya sab groups ke liye chhodo)
  3. "Enable Color Prediction Game" button click karo
โœ… Done! Enable karte hi turant start ho jayega.
2

How It Works

  • Big: Numbers 5-9 (๐Ÿ”ด Red)
  • Small: Numbers 0-4 (๐ŸŸข Green)
  • Number: Random 0-9 (๐Ÿ”ต Blue)
  • Frequency: Har 1 minute pe automatically
  • Rotation: Big โ†’ Small โ†’ Number โ†’ Big (cycle)
3

Message Format

๐ŸŽฏ COLOR PREDICTION RESULT

๐Ÿ”ด Type: BIG
๐ŸŽฒ Result: 7
โฐ Period: #123456

๐Ÿ’ฐ Win Big! ๐Ÿ’ฐ

๐Ÿงช Testing & Troubleshooting

1

Test Cron Job

Browser mein test script kholo:

https://yourdomain.com/cron/test_cron.php

Ya command line se:

php cron/send_auto_messages.php
2

Check Logs

Log file check karo:

cron/auto_messages.log

Ye file automatically create hogi jab messages send honge.

3

Common Issues

โŒ Problem: PHP nahi mil raha
Solution: PHP install karo ya PATH mein add karo. Check: php -v
โŒ Problem: Task run nahi ho raha
Solution: Task Scheduler mein task properties check karo. "Run whether user is logged on or not" check karo.
โŒ Problem: Messages send nahi ho rahe
Solution:
  • Groups registered hain ya nahi check karo
  • Bot groups mein add hai ya nahi verify karo
  • Color prediction enabled hai ya nahi check karo
  • Log file check karo errors ke liye
โŒ Problem: Webhook nahi chal raha
Solution:
  • HTTPS URL verify karo
  • Bot token correct hai ya nahi check karo
  • Webhook set hai ya nahi verify karo

โ“ Frequently Asked Questions

Q: Cron job har 1 minute pe run hoga, ye normal hai?

A: Haan, ye bilkul normal hai. Har minute pe cron job run hoga aur check karega ki koi message send karna hai ya nahi. Color prediction game ke liye ye zaroori hai.

Q: Kaise pata chale ki cron job chal raha hai?

A: Log file check karo: cron/auto_messages.log. Agar messages send ho rahe hain to log file mein entries dikhengi.

Q: Multiple groups ko kaise select karu?

A: Admin panel mein "Select Groups" section mein checkboxes hain. Multiple groups select kar sakte ho. Agar koi select nahi kiya to sab groups ko message jayega.

Q: Color prediction disable kaise karu?

A: Admin panel mein "Disable Color Prediction Game" button click karo. Disable karne se messages send hona band ho jayega.

Q: Results database mein store hote hain?

A: Haan, sab results color_predictions table mein store hote hain. Period number, type, value, aur sent status sab store hota hai.

Q: Bot ko group mein kaise add karu?

A:

  1. Group mein jao
  2. Group settings โ†’ Add Members
  3. Bot username search karo
  4. Bot ko add karo
  5. Group automatically register ho jayega

๐Ÿ”— Quick Links

Admin Panel Color Prediction Test Cron

๐ŸŽ‰ Setup Complete!
Ab aap color prediction game use kar sakte ho.

Agar koi problem aaye to log file check karo ya admin panel mein verify karo.