This project is a Discord Voice Chat Bot that can join voice channels, convert your speech to text, interact with a chatbot API, and play the chatbot's response as audio in the voice channel. It’s like having a conversational AI directly in your Discord server! 🚀
- Join Discord voice channels using the
/join
command. - Convert speech to text using
discord-speech-recognition
. - Interact with a chatbot API (e.g., Personality Forge) for intelligent responses.
- Convert the chatbot's text response to audio using Google’s Text-to-Speech API.
- Play the audio response in the voice channel.
Before you begin, ensure you have the following:
- Node.js (version 16 or higher) installed.
- A Discord Bot Token from the Discord Developer Portal.
- A Discord Server ID where the bot will operate.
- An API Key and API Secret from Personality Forge for the chatbot functionality.
-
Clone the repository:
git clone https://github.com/your-username/Discord-Voice-Chat-Bot.git cd Discord-Voice-Chat-Bot
-
Install the required dependencies:
npm install
-
Configure the
config.json
file with your credentials:{ "token": "Your Discord Bot Token", "serverId": "Your Discord Server ID", "antiCrash": true, // or false "apiKey": "Your Personality Forge API Key", "apiSecret": "Your Personality Forge API Secret" }
-
Start the bot:
npm start
Below is a table of the packages used in this project, along with their versions and installation commands:
Package | Version | Installation Command |
---|---|---|
@discordjs/voice |
^0.18.0 | npm install @discordjs/voice |
axios |
^1.5.1 | npm install axios |
discord-speech-recognition |
^3.4.1 | npm install discord-speech-recognition |
discord.js |
^14.17.2 | npm install discord.js |
dotenv |
^16.4.7 | npm install dotenv |
ffmpeg-static |
^5.2.0 | npm install ffmpeg-static |
libsodium-wrappers |
^0.7.15 | npm install libsodium-wrappers |
opusscript |
^0.1.1 | npm install opusscript |
tweetnacl |
^1.0.3 | npm install tweetnacl |
- Invite the bot to your Discord server using the OAuth2 link from the Discord Developer Portal.
- Join a voice channel in your server.
- Use the
/join
command to make the bot join the voice channel. - Start speaking! The bot will:
- Convert your speech to text.
- Send the text to the chatbot API.
- Convert the chatbot’s response to audio.
- Play the audio in the voice channel.
The config.json
file contains the following settings:
token
: Your Discord bot token.serverId
: The ID of the Discord server where the bot will operate.antiCrash
: Enable or disable anti-crash functionality (true
orfalse
).apiKey
: Your Personality Forge API Key.apiSecret
: Your Personality Forge API Secret.
Contributions are welcome! If you’d like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes.
- Submit a pull request.
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.
Enjoy building and using your Discord Voice Chat Bot! 🎉 If you have any questions or issues, feel free to open an issue on GitHub. Happy coding! 💻✨