Skip to content

A simple Telegram bot that provides helpful commands.

License

Notifications You must be signed in to change notification settings

Jesewe/telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bot

Telegram Bot

A simple Telegram bot that provides helpful commands.

FeaturesInstallationDependenciesLogging

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 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:

    git clone https://github.com/Jesewe/telegram-bot.git
    cd telegram-bot
  2. Install the required dependencies:

    npm install
  3. Create a config.json file in the root directory with the following structure:

    {
      "token": "YOUR_REAL_BOT_TOKEN_HERE",
      "botName": "Telegram Bot"
    }
  4. Run the bot:

    node bot.js

Dependencies

Logging

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

License

This project is licensed under the MIT License. See the LICENSE file for details.