This is an advanced Node.js script that automates the creation of Telegram groups using the GramJS library and generates dynamic content using the Google Gemini 1.5 Flash API.
The script logs into a personal Telegram account, creates a new group with an AI-generated name and description, and then posts a series of unique, AI-generated welcome messages to the group. It's designed with a user-friendly, colorful command-line interface and includes important safety features to mimic human behavior.
- AI-Generated Content: Uses the Gemini API to dynamically create unique group names, descriptions, and welcome messages.
- Secure Authentication: Logs into your Telegram account using your phone number and saves your session using a
StringSessionso you don't have to log in every time. - Human-Like Behavior: Implements randomized delays between actions (30-90 seconds) and between messages (15-45 seconds) to avoid account limitations.
- Multiple Messages: Sends a random number of messages (between 5 and 10) to each newly created group.
- Interactive CLI: A colorful and easy-to-use command-line interface that guides you through the process.
- Statistics: Tracks the number of groups created during a session.
- Continuous Mode: Allows you to create multiple groups in a loop without restarting the script.
- Environment-Based Configuration: Keeps your sensitive credentials safe using a
.envfile.
Before you begin, you will need the following:
- Node.js: Version 16.x or higher.
- Telegram Account: A personal Telegram account.
- Telegram API Credentials:
API_IDandAPI_HASH. You can get these from my.telegram.org.
- Google Gemini API Key:
- You can get a free API key from Google AI Studio.
-
Clone the Repository (or download the files):
git clone https://github.com/mesamirh/TG-GroupCreate-Bot.git cd TG-GroupCreate-Bot -
Install Dependencies:
npm install
-
Create a
.envfile in the root of the project directory. Copy the following content into it:# Get these from my.telegram.org API_ID= API_HASH= # Get this from Google AI Studio GEMINI_API_KEY= # This will be filled in automatically on the first run STRING_SESSION=
-
Fill in your credentials in the
.envfile forAPI_ID,API_HASH, andGEMINI_API_KEY.
-
Start the script from your terminal:
node index.js
-
First-Time Login: The first time you run the script, it will ask for your phone number, password (if you have one), and the 2FA code sent to you by Telegram.
-
Save Your Session: After a successful login, a
StringSessionwill be printed to the console. Copy this entire string and paste it into theSTRING_SESSIONvariable in your.envfile. This will allow the script to log in automatically in the future. -
Follow the Prompts: The script will then guide you through creating groups. You can choose to create more groups or exit the script when you are done.
This script is intended for educational and personal use. Automating user actions on Telegram can be against their Terms of Service. The built-in delays are designed to reduce the risk of your account being limited, but the risk is not zero. Do not decrease the delays significantly. The creators of this script are not responsible for any consequences of its use.