Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jesewe/telegram-bot
A simple Telegram bot that provides helpful commands.
https://github.com/jesewe/telegram-bot
bot js node-telegram-bot-api telegram telegram-bot
Last synced: 12 days ago
JSON representation
A simple Telegram bot that provides helpful commands.
- Host: GitHub
- URL: https://github.com/jesewe/telegram-bot
- Owner: Jesewe
- License: mit
- Created: 2024-10-19T04:54:54.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-10T05:18:26.000Z (13 days ago)
- Last Synced: 2024-12-10T06:22:05.892Z (13 days ago)
- Topics: bot, js, node-telegram-bot-api, telegram, telegram-bot
- Language: JavaScript
- Homepage: https://github.com/Jesewe/telegram-bot
- Size: 86.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Telegram Bot
A simple Telegram bot that provides helpful commands.
Features •
Installation •
Dependencies •
Logging---
# Overview
**Telegram Bot** is a basic, informative Telegram bot that interacts with users via simple commands. It's built using the [node-telegram-bot-api](https://github.com/yagop/node-telegram-bot-api) library.
## Features
- `/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.## Installation
1. Clone this repository:
```bash
git clone https://github.com/Jesewe/telegram-bot.git
cd telegram-bot
```2. Install the required dependencies:
```bash
npm install
```3. Create a `config.json` file in the root directory with the following structure:
```json
{
"token": "YOUR_REAL_BOT_TOKEN_HERE",
"botName": "Telegram Bot"
}
```4. Run the bot:
```bash
node bot.js
```## Dependencies
- **[node-telegram-bot-api](https://github.com/yagop/node-telegram-bot-api)**: Telegram Bot API wrapper for Node.js.
- **[axios](https://axios-http.com/)**: HTTP client for making requests to the external joke API.## Logging
When the bot starts, it will log the following to the console:
```bash
Telegram Bot is running...
```Any polling errors or issues fetching the joke will also be logged in the console with error details. For example:
```bash
Error fetching joke: Error message here
```## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.