This user-bot automates the process of sending gifts to users on Telegram. The bot sends star gifts to specific users and can be configured to handle both limited and non-limited gifts. It also manages a set of configurations that control the bot's behavior, such as gift price limits, sender anonymity, and more.
- General Configuration
- Settings
- File and Data Paths
- Gifts & User Info
- Custom Settings
- How to Use
- Issues
- Description: Path to the session file used by the bot to store session data.
- Default:
"data/account"
- Description: Your Telegram API ID & HASH. You need to create an application on Telegram's website to get this ID & HASH.
- Description: The time interval (in seconds) between each check for new gifts.
- Default:
10
Set it to at least 10 to avoid connection errors.
- Description: The timezone in which the bot operates. This is used for time-based operations like logging.
- Default:
"Europe/Moscow"
- Description: The ID of the Telegram channel where the bot will send notifications about the gifts.
- Description: Path to the file where the bot stores the history of sent gifts.
- Default:
"data/history.json"
- Description: List of user IDs that the bot will send gifts to. Users must have mutual contacts with the bot (i.e., both the bot and the user must be in the same group or channel).
- Description: The maximum allowed price for a gift. The bot will only send gifts below this price.
- Default:
100
- Description: If
True
, the bot will purchase non-limited gifts as they become available, respecting the maximum gift price. - Default:
False
- Description: If
True
, the bot will hide its name when sending a gift to a user. - Default:
True
- Description: A list of specific gift IDs that the bot will send. This is optional, and if not specified, all available gifts may be sent.
- Description: The number of gifts you want the bot to buy. Same quantity for all gifts!
- Default:
1
- You can modify the values of
USER_ID
,MAX_GIFT_PRICE
, andPURCHASE_NON_LIMITED_GIFTS
directly in the config file to customize how and to whom the user-bot sends gifts. - Set the
PURCHASE_NON_LIMITED_GIFTS
toFalse
if you do not want the bot to automatically buy non-limited gifts.
-
Clone or download the repository.
-
Ensure you have Python 3.10+ installed.
-
Install dependencies by running:
pip install -r requirements.txt
-
Edit the
.env
file to include your API credentials, user IDs, gift IDs, and other relevant settings. -
Run the bot:
python main.py
The bot will start sending gifts according to the configuration. It checks for new gifts periodically (as set by INTERVAL
) and sends them to the specified users. Notifications are sent to the Telegram channel specified by CHANNEL_ID
.
AttributeError: 'Client' object has no attribute 'get_star_gifts'
-
Description: The bot encounters an
AttributeError
indicating that theget_star_gifts
method is missing in theClient
object. -
Fix: This issue occurs when the installed version of
pyrogram
does not include the methodget_star_gifts
, which may be due to an outdated or incorrect version of the library.Solution 1: Reinstall the latest version of
pyrogram
:Run the following command to reinstall
pyrogram
:pip install --upgrade pyrogram
Solution 2: If the issue persists after upgrading, you can manually replace the
pyrogram
folder:- Download the pyrogram.zip.
- Drag folders from the archive to the following path:
Path to replace:
<your_project_directory>/venv/lib/pythonX.X/site-packages/pyrogram
or
C:\Users\User\AppData\Local\Programs\Python\{Python Version}\Lib\site-packages
After replacing the folder, restart the bot and the problem should most likely be resolved.
This project is licensed under the MIT License - see the LICENSE file for details.