Skip to content

πŸ€– A GPT-like Discord.js Bot that communicates with the OpenAI API.

License

Notifications You must be signed in to change notification settings

Vortrix5/discord-gpt-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Discord AI Bot

Node.js npm Discord.js OpenAI API wit.ai API GitHub license

A Discord bot that allows users to communicate with an AI using the OpenAI API.

πŸš€ Features

  • /start [text/voice]: Creates a text/voice channel to start a conversation with the bot
  • /stop [text/voice]: Destroys the connection with the bot
  • /clear: Clears the conversation prompt
  • /voice [voice]: Changes the TTS voice by choosing one from the options
  • /ask [question]: Asks one question to the bot, no conversation

πŸ’Ύ Installation

  1. Clone the repository: git clone https://github.com/vortrix5/discord-ai-bot.git
  2. Navigate to the project directory: cd discord-ai-bot
  3. Install the dependencies: npm install
  4. Create a file named .env based on the example provided: cp .env.example .env
  5. Edit the .env file and fill in the details:
TOKEN=<your discord bot token>
OPENAI_API_KEY=<your openai API key>
WITAI_API_KEY=<your wit.ai API key>

πŸ”‘ Getting a Discord Bot Token

  1. Go to the Discord Developer Portal and log in.
  2. Click the "New Application" button.
  3. Give your application a name and click "Create".
  4. Click on the "Bot" tab on the left side of the screen.
  5. Click the "Add Bot" button.
  6. Click the "Copy" button next to the "Token" field to copy the token to your clipboard.

πŸ”‘ Getting an OpenAI API Key

  1. Go to the OpenAI API documentation and click the "Sign up for an API key" button.
  2. Follow the instructions to sign up for an API key.

πŸ”‘ Getting a wit.ai API Key

  1. Go to the wit.ai website and click the "Sign up" button.
  2. Follow the instructions to sign up for an API key.

πŸ€– Usage

  1. Run the bot: npm start
  2. Invite the bot to your Discord server by following these steps:
  • Go to the Discord Developer Portal and log in.
  • Click on the application that represents your bot.
  • Click on the "OAuth2" tab on the left side of the screen.
  • Under the "Scopes" section, check the boxes for "bot" and "application.commands".
  • Under the "Permissions" section, check the box for "Administrator".
  • Click the "Copy" button next to the generated link to copy the invite link to your clipboard.
  • Open the invite link in your browser to add the bot to your Discord server.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.