Go to file
2023-04-01 22:52:04 +01:00
.dockerignore upd 2023-04-01 21:43:44 +01:00
.gitignore upd 2023-04-01 18:33:23 +01:00
bot.py upd 2023-04-01 22:52:04 +01:00
custom_openai.py upd 2023-04-01 21:43:44 +01:00
docker-compose.yml add docker 2023-03-31 21:08:16 +01:00
Dockerfile upd 2023-04-01 21:43:44 +01:00
Readme.md readme 2023-04-01 22:01:46 +01:00
Readme.ru.md readme 2023-04-01 22:01:46 +01:00
requirements.txt upd 2023-04-01 18:33:23 +01:00
transcription_dict_test.py Upd 2023-04-01 21:14:36 +01:00
transcription_dict.py Upd 2023-04-01 21:14:36 +01:00

Telegram Bot with ChatGPT

Русский

This is a simple Telegram bot that uses the ChatGPT model to generate responses to user messages. The bot is built using Python and the pyTelegramBotAPI package for interacting with the Telegram Bot API, and the OpenAI API for generating responses using the ChatGPT model.

Prerequisites

To run this bot, you will need:

  • Python 3.6 or higher
  • A Telegram bot token (you can obtain this by following the instructions here)
  • An OpenAI API key (you can obtain this by signing up for an account here)

Installation

To install the required Python packages, run the following command:

pip install -r requirements.txt

This will install the pyTelegramBotAPI and openai packages, which are needed to run the bot.

Usage

To start the bot, run the following command:

python bot.py

This will start the bot and it will begin listening for incoming messages from users. Whenever a user sends a message, the bot will use the ChatGPT model to generate a response and send it back to the user.

Usage 2

To run the bot, simply run the docker-compose up command. This will start a Docker container running the bot.

Configuration

To configure the bot, you will need to edit the bot.py file and replace the following placeholders with your own values:

  • YOUR_TELEGRAM_BOT_TOKEN_HERE: replace this with your Telegram bot token
  • YOUR_OPENAI_API_KEY_HERE: replace this with your OpenAI API key

You can also modify the generate_response function in the bot.py file to customize how the ChatGPT model generates responses.

Contributing

If you find any issues or have any suggestions for improving the bot, please feel free to open an issue or submit a pull request.

License

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