| .dockerignore | ||
| .gitignore | ||
| bot.py | ||
| custom_openai.py | ||
| docker-compose.yml | ||
| Dockerfile | ||
| Readme.md | ||
| Readme.ru.md | ||
| requirements.txt | ||
| transcription_dict_test.py | ||
| transcription_dict.py | ||
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 tokenYOUR_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.