A simple Telegram bot that provides helpful commands.
Features • Installation • Dependencies • LoggingTelegram Bot is a basic, informative Telegram bot that interacts with users via simple commands. It's built using the node-telegram-bot-api library.
/start
- Sends a welcome message when interacting with the bot./help
- Lists all available commands for the user./info
- Provides information about the bot./joke
- Fetches a random joke from an external joke API and sends it to the user.- Echoes any non-command text sent to the bot.
-
Clone this repository:
git clone https://github.com/Jesewe/telegram-bot.git cd telegram-bot
-
Install the required dependencies:
npm install
-
Create a
config.json
file in the root directory with the following structure:{ "token": "YOUR_REAL_BOT_TOKEN_HERE", "botName": "Telegram Bot" }
-
Run the bot:
node bot.js
- node-telegram-bot-api: Telegram Bot API wrapper for Node.js.
- axios: HTTP client for making requests to the external joke API.
When the bot starts, it will log the following to the console:
Telegram Bot is running...
Any polling errors or issues fetching the joke will also be logged in the console with error details. For example:
Error fetching joke: Error message here
This project is licensed under the MIT License. See the LICENSE file for details.