Skip to content

RareMojo/discord-ai

Repository files navigation

Discord Follow GitHub Repo stars LangChain Integration LICENSE Discord Follow


Discord-AI




Your communities personal assistant.

Check out GPT-Engineer! »


About Discord-AI

Discord-AI is a super smart and versatile AI assistant for Discord communities!

Its primary objective is to serve the specific needs of the GPT Engineer Discord community. This version you see here is the open-source adaptation, allowing anyone to benefit from its awesome features!

Whether you need information, want to chat, interact with documents, code, explore websites, or enjoy some cool Discord-only features, Discord-AI has got your back. It's designed to be user-friendly, customizable, and open source – just the way you like it!

We're all about community here! Join us in making our idea even better. Your thoughts and contributions are always welcome.

Let's level up your Discord experience with Discord-AI, the friendly AI chatbot for everyone! 🤖💬


Prerequisites

Before you begin, ensure you have met the following requirements:


OpenAI API Key

  1. Sign up at OpenAI: Visit the OpenAI website and sign up for an account.
  2. Obtain your API key: Click your profile icon and select "View API keys" from the dropdown menu. Then, click the "Create new secret key" button to generate a new API key.

Pinecone DB

  1. Sign up for Pinecone: Visit the Pinecone website and sign up for an account.
  2. Get your Pinecone API key: After signing up, navigate to your dashboard and obtain your Pinecone API key, index, and environment. Watch this Video Tutorial for assistance.

MongoDB

  1. Sign up for Railway: Visit the Railway.app website and sign up for an account.
  2. Create a new project: Follow the official Railway documentation to create a new project.
  3. Add MongoDB plugin: In your Railway project, add the MongoDB plugin by following the official Railway documentation.
  4. Get your MongoDB URI: After adding the MongoDB plugin, navigate to the plugin settings and obtain your MongoDB URI. Watch this Video Tutorial for assistance.

Installation

To install Discord-AI, follow these steps:


  1. Clone the repository:

    git clone https://github.com/RareMojo/discord-ai.git


  1. Navigate to the project directory:

    cd discord-ai


  1. Run the start script:

    • For Windows:
      start.bat

    • For Linux/Mac:
      sh start.sh


Configuration

  1. example_.env | .env:

    • You will need to provide Discord Token and API keys for the bot to function properly.
    • You also need to provide the Discord server ID, category ID, and threads ID.
    • The category ID is the ID of the chat category all of your AI chat channels will be in.
    • The threads ID is the ID of the threads channel that will be used for generic agent interaction.

    Open example_.env file in the root directory of the project, and add your keys:

     OPENAI_API_KEY=your-key-here
     DISCORD_TOKEN=your-token-here
     DISCORD_GUILD_ID=your-server-id-here
     CHATBOT_CATEGORY_ID=your-aichat-category-id-here
     CHATBOT_THREADS_ID=your-aichat-threads-id-here
     OPENAI_MODEL=gpt-3.5-turbo-16k
     MONGO_URI=your-mongo-uri-here
     PINECONE_API_KEY=your-pinecone-api-key-here
     PINECONE_INDEX=your-pinecone-index-here
     PINECONE_ENV=your-pinecone-env-here
    

    Rename the file to .env if you haven't already and save it.


  1. configs\config.json:

    • You will be prompted to fill out the required parts of this during setup automatically.
    • You may directly edit this file to change anything as well.
    • If you change something that should be updated with the Discord servers, change update_bot to true.
    • You can also edit most of the config values via the bot terminal.

  1. configs\preprompts:

    • This is a small preprompt that is injected before chat interactions.
    • It maintains small details such as the bot's name and personality.
    • You may directly edit this to fit your needs.

  1. TMUX (Optional):

    • This is used to run the bot like a service in a separate terminal.
    • You can install it by running sudo apt install tmux on Linux.
    • Feel free to use other methods of running the bot in the background.
    • TMUX Tutorial

Usage

After installation and configuration, the bot will run automatically.
It uses the GPT model to interact with users in the specified Discord channel.
Currently, it can ingest ReadTheDocs URLs and provide help using it as context.


Here is a step-by-step guide on how to use the bot:


  1. Channel Setup:

    • The bot can be set up in any channel of your Discord server.

    • This is an example of a proper setup. Copy the category ID and paste it in the .env file.

    • Yours does not need to be the same. Just make certain you use the correct channel IDs.

      Channel Setup


  1. Thread Listing:

    • This is an example of the thread listing within the threads section that is to be used for generic agent interaction.

    • Copy the thread channel ID and paste it in the .env file.

      Thread Listing


  1. Help DB:

    • The bot can provide help related to database commands.

    • Use the /helpdb command to get a list of all database related commands.

      Help DB


  1. Ingest DB:

    • The bot can ingest data into the database.

    • Currently, the only supported data type is ReadTheDocs URLs.

    • Example: https://gpt-engineer.readthedocs.io/en/latest/

    • Use the /ingestdb command followed by the data you want to ingest and a name for the data.

      Ingest DB


  1. List DB:

    • The bot can list all the data in the database.

    • Use the /listdb command to get a list of all the data in the database.

      List DB


  1. AI Chat:

    • The bot can interact with users in the specified Discord channel.

    • Make a thread in the designated ai-chat thread, and the chatbot will automatically start interacting with you.

      AI Chat


  1. Ask DB:

    • The bot can fetch information from the database.

    • Use the /askdb command followed by your query and the db ID to get the required information.

    • The ID is set to the gpt-engineer-docs database by default.

      Ask DB


Contributing to Discord-AI

To contribute to Discord-AI, follow these steps:


  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>
  3. Make your changes and commit them: git commit -m <commit_message>
  4. Push to the original branch: git push origin <project_name>/<location>
  5. Create the pull request.

Alternatively, see the GitHub documentation on creating a pull request.


Credits & Thanks

I'm grateful to the creators of these open source projects:


Their contributions have enhanced and reduced workload for our chat bot's functionality and streamlined documentation.
Thank you, Haste171, for inspiring developers and allowing others to incorporate and use your work.


License

Discord-AI is completely open source, licensed under the MIT license. See LICENSE.md for more information.

Logo was made with the amazing and fun to use Stable Diffusion

About

A LangChain integrated Discord chatbot. Used by GPT Engineer's Discord server.

Topics

Resources

License

Stars

Watchers

Forks

Languages