GPT-powered discord chatbot
- Get an OpenAI API key at https://platform.openai.com/account/api-keys.
- Replace 'your_api_key' with your API key.
- Register your Discord bot at Discord Developer Portal https://discord.com/developers/applications.
- Click "New Application" and give it a name
- Click on "Bot" and "Add Bot"
- Copy the bot token and replace 'your_discord_bot_token' with your bot token.
- If the token doesn't appear, click "Reset Token" and it'll be there.
- Click on OAuth2, select "bot" from scopes, then select "Send Messages" and "Read Message History" (or just administrator, if you're lazy), and copy paste the generated URL at the bottom into your browser or Discord to invite the bot to your server.
- Install the necessary dependencies from the requirements.txt file (if you're using VSCode, there should be a "Build environment" button when you open the file, otherwise type 'pip install openai discord' into powershell).
- Run the python file!
PS. If you don't want to talk to the bot in the server, DMing it works too.
PS.2 As of 4/10/2023, the bot doesn't have a context window, meaning it doesn't have any memory of messages aside from the latest one.