// Credit to github.com/nbmsacha for initial implementation.
- Error Handling
- Logging
- Unit Tests
- Documentation
- Deployment Guide
- Security Measures
Use the .env.example
placeholders as a guide.
-
Copy the Template: Duplicate the
.env.example
file and rename it to.env
. -
Fill in the Values: See comments. Warning: Setting the
API_ID
andAPI_HASH
allows the bot to access your Telegram account and perform actions on your behalf. Ensure these values are kept secure. -
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 page. Follow the instructions to register your application and receive your API_ID
and API_HASH
.
-
Install Dependencies: Ensure you have Node.js installed, then run the following command to install the necessary packages:
npm install
-
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 yourAPI_ID
andAPI_HASH
. You can start the bot using:node src/index.js
The bot will connect to Telegram and start listening for commands.
-
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. -
Running the Server: If your application includes a server component, you can start it using:
node src/bot/server.js
The server will listen for incoming requests and process them accordingly.
To run the tests, use the following command:
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.
- Description: Creates a new Telegram group.
- Parameters:
name
: Name of the group.type
: Type of the group.
- Response:
link
: Invite link to the group.