This is a Telegram bot that uses ChatGPT to generate responses to messages.
- Create a Telegram bot using @BotFather
- Apply for a OpenAI API key here
- Run the bot (preferably as a Docker container) with the following environment variables:
OPEANAI_APIKEY
: Your OpenAI API keyTELEGRAM_TOKEN
: Your Telegram bot token
Here's an Docker compose example:
version: '3.5'
services:
chatgptbot:
image: h00s/chatgpt-telegram-bot
container_name: chatgptbot
stop_grace_period: 15s
restart: unless-stopped
environment:
- TELEGRAM_TOKEN=123456:abc
- CHATGPT_APIKEY=sk-123456
/start
: Start the bot/hello
: Test the bot if it's working/new
: Start a new conversation (chatgpt will forget the previous conversation)
Any message sent to the bot will be sent to chatgpt and the response will be sent back to the user.