Skip to content

devYahia/Area51

Repository files navigation

🎁 TelegramGiftsBot

Telegram bot for automated gift purchases. Supports both bot and userbot modes by connecting your own Telegram account session. Features profile configuration and full purchase automation. No commissions. Open source code available for everyone.


📦 Features

  • Smart Gift Filtering: Purchase gifts based on customizable filters including minimum/maximum price, supply limits, and purchase quantity.
  • Dual Mode Support: Works both as a bot and userbot - connect your own Telegram session for direct account purchases.
  • SOCKS5 Proxy Support: Connect SOCKS5 proxies for userbot and aiohttp sessions for enhanced privacy.
  • Parallel Gift Checking: Simultaneously checks gift lists from multiple sources (bot + userbot) and selects the best available option.
  • Multiple Profiles: Add up to 3 independent profiles with different recipients and limits.
  • Real-time Notifications: Get instant notifications for successful purchases and task completions.
  • Interactive Menu Control: Manage everything through an intuitive Telegram interface.
  • Purchase Tracking: Built-in purchase counter with automatic stopping when limits are reached.
  • Purchase Reports: Detailed transaction reports with purchase history and analytics.
  • Telegram Stars Integration: Top up and refund through Telegram Stars payment system.
  • Multi-account Balance: Allow balance top-ups from any Telegram account.
  • Bot Testing: Test bot functionality with a 15-star gift purchase.
  • Gift Catalog: Browse complete gift catalog and purchase specific gifts in desired quantities.
  • Bulk Refunds: Return all stars from the bot with a single command.
  • Redis Integration: Connect to Redis for receiving gift lists from external sources.

🚀 Quick Start

Requirements:

  • Python 3.10.11 or higher

1. Clone the repository:

git clone https://github.com/devYahia/Area51
cd TelegramGiftsBot

2. Install dependencies:

pip install -r requirements.txt

3. Create .env file

Create a file named .env in the project root. This file is used to store environment variables.

Example:

TELEGRAM_BOT_TOKEN=123456:abcdefghijklmnopqrstuvwxyz
TELEGRAM_USER_ID=123456789
  • TELEGRAM_BOT_TOKEN — Your Telegram bot token obtained from @BotFather
  • TELEGRAM_USER_ID — Your Telegram user ID (get it from @userinfobot)

4. Run the bot:

python main.py

📂 Project Structure

  • main.py — Main script and bot entry point
  • requirements.txt — Project dependencies
  • .env — Environment variables file (excluded from git)
  • config.json — User configuration file (excluded from git)
  • handlers/ — Event handlers (handlers_main.py, handlers_wizard.py, etc.)
  • middlewares/ — Middleware for access control and other update processing aspects
  • services/ — Business logic and gift manager (balance.py, buy.py, config.py, menu.py, purchase_report.py, etc.)
  • utils/ — Utilities and helper scripts (logging.py, misc.py, mockdata.py, proxy.py)

🛠 For Developers

  • All handlers are stored in handlers/ - you can add your own scenarios by creating new files.
  • Main business logic is extracted to services/ - convenient for reuse and testing.
  • utils/ contains helper functions that can be extended without risk of breaking core logic.
  • middlewares/ contains custom intermediate processors (e.g., access control, logging).
  • Purchase Reports: New feature in services/purchase_report.py provides detailed transaction tracking and history.

📝 Changelog

v1.5.0 (2025-01-XX)

  • NEW: Added comprehensive purchase report system with detailed transaction tracking
  • NEW: Purchase history viewer with analytics and statistics
  • NEW: Real-time purchase notifications with actionable buttons
  • Enhanced error handling and logging for purchase operations
  • Improved code structure and documentation

v1.4.0 (2025-08-08)

  • Added ability to select gift list check interval for Userbot
  • Added option to enable/disable bot top-ups from other accounts
  • Added Redis connection capability for receiving gift lists from external sources
  • Improved code and project structure

v1.3.0 (2025-07-18)

  • Added Telegram session connection capability (userbot)
  • Removed ability to request star withdrawals from other accounts
  • Bot owner can now refund stars to users by user_id and transaction_id
  • Added profile renaming functionality
  • Optimized code and improved project structure

v1.2.0 (2025-06-28)

  • Added profiles for gift purchasing
  • Support for bot balance top-ups from any accounts
  • Added spam protection
  • Improved code and project structure

v1.1.0 (2025-06-21)

  • Added gift catalog with quantity selection for purchases
  • Support for returning all stars with a single command
  • Improved project structure

v1.0.1 (2025-06-16)

  • Added test gift purchase functionality

v1.0.0 (2025-06-15)

  • First working version: gift purchasing, filter configuration, balance tracking

📸 Screenshots

Bot main menu:
Bot Interface


☁️ Serverless Hosting

If you don't want to deal with VPS and environment setup — use ready-made Telegram hosting.

The @GiftsHostingBot allows you to connect this bot for gift purchasing in seconds.

⚙️ How it works?

  1. Get a token from @BotFather (command /newbot).
  2. Open @GiftsHostingBot and send the command /addbot.
  3. Enter the token — the bot will be activated on the server.

💡 Why is it convenient?

  • No installation and configuration required
  • Everything works automatically on the server
  • You can connect multiple bots
  • Available even without technical knowledge

⚠️ Important

The hosting may not have the latest version of the bot. This is done to ensure there are no bugs. Updates to the latest version happen automatically after stability verification.

🛡 Security

  • Token is never stored in plain text.
  • You can disable the bot at any time through @BotFather, command /revoke.
  • ☎️ Setup and hosting assistance: available on request

🧑‍💻 Support


📜 License

This project is distributed under the MIT License.

About

Advanced Telegram bot for automated gift purchasing with multi-profile support, purchase reports, and comprehensive filtering system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages