A Discord bot that allows users to communicate with an AI using the OpenAI API.
/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
- Clone the repository:
git clone https://github.com/vortrix5/discord-ai-bot.git
- Navigate to the project directory:
cd discord-ai-bot
- Install the dependencies:
npm install
- Create a file named
.env
based on the example provided:cp .env.example .env
- 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>
- Go to the Discord Developer Portal and log in.
- Click the "New Application" button.
- Give your application a name and click "Create".
- Click on the "Bot" tab on the left side of the screen.
- Click the "Add Bot" button.
- Click the "Copy" button next to the "Token" field to copy the token to your clipboard.
- Go to the OpenAI API documentation and click the "Sign up for an API key" button.
- Follow the instructions to sign up for an API key.
- Go to the wit.ai website and click the "Sign up" button.
- Follow the instructions to sign up for an API key.
- Run the bot:
npm start
- 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.
This project is licensed under the MIT License - see the LICENSE file for details.