https://github.com/hydepwns/telegram-partner-bot
automate the creation and management of Telegram groups
https://github.com/hydepwns/telegram-partner-bot
telegram
Last synced: 8 months ago
JSON representation
automate the creation and management of Telegram groups
- Host: GitHub
- URL: https://github.com/hydepwns/telegram-partner-bot
- Owner: Hydepwns
- License: mit
- Created: 2024-10-30T16:20:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-08T13:55:13.000Z (over 1 year ago)
- Last Synced: 2024-11-08T14:43:31.407Z (over 1 year ago)
- Topics: telegram
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telegram-partner-bot
// Credit to github.com/nbmsacha for initial implementation.
## Table of Contents
1. [Introduction](#introduction)
2. [Environment Setup](#environment-setup)
3. [Running the Application](#running-the-application)
4. [Missing Elements](#missing-elements)
## Missing Elements
- Error Handling
- Logging
- Unit Tests
- Documentation
- Deployment Guide
- Security Measures
## Introduction
### Environment Setup
### `.env.example`
Use the `.env.example` placeholders as a guide.
1. **Copy the Template**: Duplicate the `.env.example` file and rename it to `.env`.
2. **Fill in the Values**: See comments. **Warning**: Setting the `API_ID` and `API_HASH` allows the bot to access your Telegram account and perform actions on your behalf. Ensure these values are kept secure.
3. **Secure the File**: Ensure that the `.env` file is added to your `.gitignore` to prevent it from being committed to version control.
**Where to Obtain API_ID and API_HASH**: You can obtain these values by creating a new application on the [Telegram API Development Tools](https://my.telegram.org/apps) page. Follow the instructions to register your application and receive your `API_ID` and `API_HASH`.
### Running the Application
1. **Install Dependencies**: Ensure you have [Node.js installed](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs), then run the following command to install the necessary packages:
```bash
npm install
```
2. **Start the Bot**: The application will automatically generate a session string if it is not present in the `.env` file. Ensure your `.env` file is correctly configured with your `API_ID` and `API_HASH`. You can start the bot using:
```bash
node src/index.js
```
The bot will connect to Telegram and start listening for commands.
3. **Using the Bot**: The bot can handle commands sent to it. For example, you can use the `/set` command to update configuration values dynamically. The bot will respond with confirmation messages.
4. **Running the Server**: If your application includes a server component, you can start it using:
```bash
node src/bot/server.js
```
The server will listen for incoming requests and process them accordingly.
### Testing
To run the tests, use the following command:
```bash
npm test
```
This will execute the test suite located in `src/tests/test_main.js`, which includes tests for the Telegram client initialization and authentication.
## API Endpoints
### POST /createGroup
- **Description**: Creates a new Telegram group.
- **Parameters**:
- `name`: Name of the group.
- `type`: Type of the group.
- **Response**:
- `link`: Invite link to the group.