Discord bot using ChatGPT API
first, write token/channelID to .env
file.
DISCORD_TOKEN=[discord bot token]
DISCORD_CHANNELID=[space-separated channel ids to use the bot]
GPT_SECRET_KEY=[OpenAI APIKEY]
Run prebuilt binary locally
curl -kLO https://nightly.link/pycabbage/discordgpt/workflows/build/main/discordgpt-linux-amd64.zip
unzip discordgpt-linux-amd64.zip
chmod +x discordgpt-linux-amd64
./discordgpt-linux-amd64
Run prebuilt image
docker run --rm -it --env-file .env ghcr.io/pycabbage/discordgpt:latest
# or specify token/channelID
docker run --rm -it \
-e DISCORD_TOKEN=[discord bot token] \
-e DISCORD_CHANNELID=[space-separated channel ids to use the bot] \
-e GPT_SECRET_KEY=[OpenAI APIKEY] \
ghcr.io/pycabbage/discordgpt:latest
# Build binary
go build -o discordgpt
# Run
./discordgpt
# Build binary
GOOS=linux GOARCH=amd64 go build -ldflags '-w -s' -o discordgpt-linux-amd64
# Build container
docker build . -t discordgpt:latest --build-arg BINARY=discordgpt-linux-amd64
# Run container
docker run --rm -it --env-file .env discordgpt:latest