Skip to content

Latest commit

 

History

History
96 lines (63 loc) · 3.39 KB

README.md

File metadata and controls

96 lines (63 loc) · 3.39 KB

telegram-smartguide-bot: Location Guide Bot

This project is a bot designed to provide location-based information and services. Follow the instructions below to set up the project and obtain the necessary API keys. Running example https://t.me/smgdbot (can be unavailable sometimes)

How it works

Bot listening for the telegram api "location" event both with "edited_message" event (for the location translation).

First we should get the interesting places nearby. GPT is awful for this purpose.

Yandex API helps in this case but it also has no ready functionality for sightseeing.

A small "hack": we search in yandex geosuggest api for the hardcoded keywords instead like "достопримечательность" (sight).

After we get the results, we filter them using gpt-4o-mini.

Finally we ask gpt-4o to fulfill the answer.

Prerequisites

  • Node.js (v18 or higher)
  • npm
  • A valid API key for the required services

Obtaining API Keys

The bot requires API keys from the following services:

1. TELEGRAM_API_KEY (free)

To obtain a Telegram Bot API key, follow these steps:

  1. Open Telegram and search for the "BotFather" user.
  2. Start a chat with BotFather and send the command /newbot.
  3. Follow the instructions to set up your bot, including choosing a name and username for your bot.
  4. Once the bot is created, BotFather will provide you with an API key. Copy this key for use in your project.

For more details, refer to the Telegram Bot API documentation.

2. OPENAI_API_KEY (paid)

To obtain an OpenAI API key, follow these steps:

  1. Visit the OpenAI website and sign up for an account if you don't already have one.
  2. Log in to your OpenAI account and navigate to the API section of the dashboard.
  3. Click on "Create new secret key" to generate a new API key.
  4. Copy the generated API key and store it securely. You will not be able to view it again after closing the dialog.

For more details, refer to the OpenAI API documentation.

3. YANDEX_GEOSUGGEST_API_KEY (free up to 1000 req/daily)

To obtain a Yandex Geosuggest API key, follow these steps:

  1. Visit the Yandex Developer Console and sign in with your Yandex account. If you don't have an account, create one.
  2. Go to the "API Keys" section, select the Geosuggest API.
  3. Click on "Create API Key" and follow the instructions to generate a new key.
  4. Copy the generated API key and store it securely for use in your project.
  5. It may take up to few hours before the recently created key activated.

For more details, refer to the Yandex Geosuggest API documentation.

Setting Up the Project

  1. Clone the repository:

    git clone https://github.com/studentIvan/telegram-smartguide-bot
    cd telegram-smartguide-bot
  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory and add your API keys:

    TELEGRAM_API_KEY="your-key"
    OPENAI_API_KEY="your-key"
    YANDEX_GEOSUGGEST_API_KEY="your-key"
  4. Start the bot:

    npm start

Contributing

Feel free to submit issues or pull requests to improve the project.

License

This project is licensed under the MIT License.