Skip to content

OpenAI Discord is a AI-powered bot for Discord that leverages the OpenAI API. It enables users to interact with ChatGPT and DALL-E in a natural and efficient manner.

License

Notifications You must be signed in to change notification settings

KrozT/openai-discord

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

OpenAI Discord

Codacy Badge

A simple Discord bot integrating OpenAI libraries for ChatGPT and DALL-E, capable of generating text and images in Discord conversations.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Commands API
  5. Roadmap
  6. Contributing
  7. License
  8. Acknowledgments

About The Project

Formerly known as 'Aurora AI', Aurora AI is a Discord chatbot that utilizes the GPT-3.5-Turbo language model by OpenAI. Built with discord.js, it generates responses to user input in a conversational format. Designed for simplicity, it's a great tool to explore the capabilities of GPT-3.5-Turbo within Discord. Additionally, it also supports the use of DALL-E, the image generation model also developed by OpenAI, allowing it to generate creative images alongside its natural language abilities.

Screenshots

Images

Aurora AI ScreenShot 1 Aurora AI ScreenShot 2

(back to top)

Built With

  • TypeScript

Packages

(back to top)

Getting Started

Installation

  1. Get a necessary API Keys


  2. Clone the repo

    git clone https://github.com/KrozT/openai-discord.git
  3. Install packages

    pnpm install
  4. Add the API Keys to your environment variables

    DISCORD_API_KEY=<YOUR DISCORD API KEY>
    OPENAI_API_KEY=<YOUR OPENAI API KEY>
  5. Build project

    pnpm run build
  6. Start binaries

    pnpm run start

(back to top)

Usage

Once you have the project initialized just add the bot to your server and enjoy.

Commands

Command Options Type Description
/ping ephimeral embed-info Ping the bot to check if it is online
/about ephimeral embed-info Get information about the bot
/help ephimeral embed-info Get a list of all the commands
/chat question ephimeral embed-request embed-response Chat with the bot
/clear amount embed-info Clear the chat history with the bot
/image prompt quantity size ephimeral embed-request embed-response Generate an image with the prompt provided

Options

Option Command Required Default Choices Description
question /chat true None None The question to ask the bot
prompt /image true None None The text to generate the image from
quantity /image false 1 1 to 10 Quantity of images to generate
size /image false 256x256 256x256 512x512 1024x1024 Size of the image to generate
amount /clear false 100 1 to 100 Amount of messages to clear
ephimeral /ping /about /help /chat /image false false true false Hide the response from other users

(back to top)

Embeds

The bot uses a variety of visual embeds code located in the footer of each message. The following table describes the embeds and their colors.

Footer Color Description
embed-info Aqua System message by the bot
embed-error Red Error message by the bot
embed-response Green Response by the bot with AI-generated content
embed-request Gold Request by the user

(back to top)

Commands API

You can add new commands to the project by following these steps:

  1. Create a new file in the src/bot/commands folder with the name of the command you want to add (e.g. testCommand.ts).
  2. Write a class that extends the Command and implements all the methods.
  3. Your command will be automatically added to the bot.

Command example:

import { Command } from '@/bot/models/command';
import { Client, CommandInteraction } from 'discord.js';

export class TestCommand extends Command {
    public configure(): void {
        this.setName('test');
        this.setDescription('Test command');
        this.addEphemeralOption(); // Add the ephemeral option to the command
    }

    protected async execute(client: Client, interaction: CommandInteraction): Promise<void> {
        await interaction.reply({content: 'Test command executed', ephemeral: this.ephermeral});
    }
}

(back to top)

Roadmap

  • Docker Integration
    • Dockerfile
    • Docker Compose
  • Discord Integration
    • API REST
    • Slash Commands
    • Text Channels
      • Ephemeral (Optional)
    • Direct Messages
      • Ephemeral (Optional)
  • Language Model Integration
    • GPT-3.5
      • Chat
    • GPT-4
  • DALL-E Integration
    • Image generation
    • Image editing
  • Context-based usability
    • Single user
    • Multiple users

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Acknowledgments

(back to top)