Discord Chat AI

Discord Chat-AI

Discord Chat-AI is a project that is designed to take Discord’s chatbots to the next level of conversation. With the power of GPT-3, it is possible to create unique characters with exciting or funny backstories that will amaze your Discord users.

If you liked this project, feel free to leave a star ⭐ , it helps the project a lot! Thank you!

🤖 Project

Discord Chat-AI is a node js based Discord chatbot. It combines discord.js v13 with gpt-3 from openai to create interesting and exciting conversations.

  • Node v16+
  • openai v2+
  • discord.js v13

What is GPT-3?

GPT-3, or the third generation Generative Pre-trained Transformer, is a neural network machine learning model trained using internet data to generate any type of text. Developed by OpenAI, it requires a small amount of input text to generate large volumes of relevant and sophisticated machine-generated text.

GPT-3’s deep learning neural network is a model with over 175 billion machine learning parameters. To put things into scale, the largest trained language model before GPT-3 was Microsoft’s Turing NLG model, which had 10 billion parameters.

Learn more about GPT-3 in this great article and of course on OpenAI’s website

✅ Requirements

  • GPT-3 API key
  • Discord developer account

🚀 Features

  • Easily configurable chatbot character properties
  • Persistent memory
  • Easy to set up
  • Variable length of the chat history
  • Easy to use

📁 Installation

Step 1. Run npm install after cloning the project to install the required dependencies.

Step 2. Log in to your Discord developer account and create a Discord bot.

Step 3. Create a .env file in the project root and add the Discord token of the created bot in DISCORD_TOKEN.

Step 4. Log in to your OpenAI Account and add your API key in the .env file in the OPENAI_API_KEY field.

Step 5. Start the Discord bot with the command node ..

Step 6. Enjoy your bot !

👨🏽‍💻 Configuration

  • Configure the backstory of your chatbot by editing the backstory property in the chatData.json file in the root directory of the project.

    {
        "backstory": "The following is a conversation with a chat AI created for Discord. The chat AI is helpful, creative, clever and very friendly."
    }
    
  • Configure some predefined conversations to further specify the properties of the chatbot’s responses. To do this, you need to edit the predefinedConversations property in the chatData.json file at the root of the project.

    {
        "predefinedConversations":[
            {
                "human":"Hello, who are you?",
                "ai":"I am an AI created by OpenAI. How can I help you today?"
            },
            {
                "human":"How are you today?",
                "ai":"I'm feeling great today. Thanks for speaking with me."
            },
            {
                "human":"What is your favorite thing to do?",
                "ai":"I love to chat with people like you!"
            }
    }
    
  • Configure the maximum number of saved conversations by editing the MAX_CHAT_HISTORY property in the .env file in the project root directory.

    The default value is 100.

    MAX_CHAT_HISTORY = 69
    

Contributing ✨

Feel free to contribute. Whether it’s a feature request or a pull request, any kind of contribution is welcome!

GitHub

View Github