It uses the chatgpt package to interact with the ChatGPT model and the telegraf package to interact with the Telegram API.
Create a .env
file with the following variables:
OPENAI_API_KEY=KEY
TELEGRAM_BOT_TOKEN=TOKEN
TELEGRAM_CHAT_ID_ADMIN=ID
TELEGRAM_ALLOWED_CHAT_IDS=ID1,ID2,ID3
Use pnpm as the package manager:
pnpm install
Build:
pnpm build
Build and run:
pnpm run run
Create the image:
docker build -t chatgpt_bot:1.0.0 .
Run the container:
docker run -it -d \
--name chatgpt_bot \
--hostname chatgpt_bot \
--restart unless-stopped \
--env-file ./.env \
chatgpt_bot:1.0.0