Skip to content

Discord chatbot integrating GPT-4 for advanced conversational AI capabilities, enabling dynamic interactions and responses within Discord servers

License

Notifications You must be signed in to change notification settings

nokitakaze/GPT-4-Discord-Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT-4 Discord Bot

This repository hosts the code for a Discord bot that leverages the power of OpenAI's GPT-4 to provide advanced conversational AI capabilities. Designed to facilitate dynamic interactions, the bot enriches Discord servers with responsive and intelligent dialogues.

Features

  • The bot supports a dialogue mode with multiple users, distinguishes between users, and tracks the context of the dialogue
  • It is possible to choose the bot's model

Requirements

  • Node.js (v16.16 or newer) / Docker
  • Discord bot
  • OpenAI API

Discord

  1. Create a new Discord bot https://discord.com/developers/applications
  2. [Your bot] -> Bot -> "Reset token" button for acquiring your secret token
  3. [Your bot] -> Bot -> Message content intent, Presence intent, Server members intent -> "On"
  4. https://discord.com/oauth2/authorize?client_id=[BOT_ID]&scope=bot&permissions=274878023680

OpenAI

  1. Top up your OpenAI API balance. Please note, this is not the balance of the main account. https://platform.openai.com/account/billing/overview
  2. Create a new API Key. For simplicity, I use Permissions=All. https://platform.openai.com/api-keys
  3. Select the model to be used. By default, it is gpt-4. https://platform.openai.com/docs/models/overview

Installation

  1. Clone this repository:

    git clone https://github.com/nokitakaze/GPT-4-Discord-Chatbot.git
  2. Copy .env.example to .env and fill in your Discord bot token and OpenAI API key:

    OPENAI_API_KEY=your_openai_api_key
    #GPT_MODEL=gpt-4
    GPT_PROMPT="You are a helpful assistant. Respond briefly, but informatively."
    DISCORD_BOT_TOKEN=your_discord_bot_token
    

    Optionally set GPT_MODEL to the desired model: https://platform.openai.com/docs/models/overview

  3. Start it with docker

    docker-compose up --build

    Or manually

    npm i
    npm start

See also

About

Discord chatbot integrating GPT-4 for advanced conversational AI capabilities, enabling dynamic interactions and responses within Discord servers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published