ChatGPT-discord-bot

chatGPT-discord-bot

This is a project that provides you to build your own Discord bot using ChatGPT

⭐️ If this repo helps you, a star is the biggest support for me and also helps you stay up-to-date

Warning

2022-12-15 Update: Cloudflare are currently preventing the bot from receiving any further messages, so the bot is using the official GPT-3 API until this chaos about cat catching mice ends

2022-12-12 Update: OpenAI added Cloudflare protections to their API in ChatGPT, there are some differences in using it on server and desktop environment

Features

Chat

image

Mode

Setup

Install

  1. pip install -r requirements.txt

Step 1: Create a Discord bot

  1. Go to https://discord.com/developers/applications create an application
  2. Build a Discord bot under the application
  3. Get the token from bot setting

    image

  4. Change the file name of config.dev.json to config.json
  5. Store the token to config.json under the discord_bot_token

    image

  6. Turn MESSAGE CONTENT INTENT ON

    image

  7. Invite your bot to your server via OAuth2 URL Generator

    image

Step 2: Geanerate a OpenAI API key

  1. Go to https://beta.openai.com/account/api-keys

  2. Click Create new secret key

    image

  3. Store the SECRET KEY to config.json under the openAI_key

Step 3: Run the bot on the desktop

  1. Open a terminal or command prompt
  2. Navigate to the directory where you installed the ChatGPT Discord bot
  3. Run python3 main.py to start the bot

Step 3: Run the bot with docker

  1. Build the Dcoker image & Run the Docker container docker compose up -d
  2. Inspect whether the bot works well docker logs -t chatgpt-discord-bot

    Stop the bot:

    • docker ps to see the list of running services
    • docker stop <BOT CONTAINER ID> to stop the running bot

Have A Good Chat !

Optional: Setup starting prompt


RIP to Reverse Engineered ChatGPT by OpenAI here