Before you begin, ensure you have met the following requirements:
- You have installed Node.js (version 12.x or later)
- You have a Telegram account and have created a bot using BotFather
To set up the project, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory and add your bot token:BOT_TOKEN=your_bot_token_here
To run the bot in development mode:
npm run dev
This will start the bot using nodemon
, which will automatically restart the bot when you make changes to the code.
To build the production version of your bot:
npm run build
This will compile your TypeScript code into JavaScript in the dist
directory.
To start the bot in production mode:
npm start
src/bot.ts
: The main file containing the bot logicpackage.json
: Project configuration and dependenciestsconfig.json
: TypeScript configuration.env
: Environment variables (make sure to keep this file private).gitignore
: Specifies which files Git should ignore