A simple bot written in Python using the Telethon library to automatically monitor and purchase Star Gifts in Telegram. The project was created for personal use but can be easily configured for your tasks.
- Automatic Gift Detection: Periodically checks for new Star Gifts available for purchase.
- Flexible Filtering: Allows you to configure criteria for purchasing, such as price, limited status, and availability.
- Automated Purchasing: Automatically buys selected gifts for a predefined list of recipients.
- Real-time Logging: Provides detailed logs of its actions, both in the console and in a specified Telegram chat.
- Balance Control: Tracks the current star balance and stops purchasing when funds are insufficient.
Follow these steps to set up the bot:
-
Clone the repository:
git clone https://github.com/default034/UserBot-GiftsBuyer.git cd your-repository -
Install the required libraries: It is recommended to use a virtual environment.
pip install -r requirements.txt
-
Configure the bot: Rename
config.py.exampletoconfig.pyand fill it with your data:API_IDandAPI_HASH: You can get these from my.telegram.org.SESSION: The name for the session file (e.g.,"my_account").RECIPIENTS: A list of usernames or IDs of the users to whom gifts will be sent.PRICE_MIN,PRICE_MAX: The price range for gifts to be purchased.LOG_CHAT: The username or ID of the chat where logs will be sent.
To launch the bot, run the following command in your terminal:
python main.pyAfter launching, the bot will start its work, and you will see logs in the console or in the specified log chat.
The config.py file allows for detailed customization of the bot's behavior:
POLL_INTERVAL: The interval in seconds between checks for new gifts.ONLY_LIMITED: Set toTrueto purchase only limited gifts.GIFT_TYPES: A dictionary to specify the types of gifts to buy (e.g.,{"birthday": True}).HIDE_NAME: Set toTrueto send gifts anonymously.MESSAGE_TEXT: A message to be sent along with the gift.
This project was created for personal use, but I am open to suggestions and contributions. If you have ideas for improvement or find a bug, feel free to create an Issue or a Pull Request.
This project is distributed under the MIT License. See the LICENSE file for more information.
