This is a chatbot which integrates with Hume AI API and Discord to have a conversational AI system in Discord voice channels.
The bot uses the Discord.js library to connect to the Discord API and the Hume AI API https://www.hume.ai/
Hume allows for real-time audio processing and understanding. It can be used to detect emotions, understand intent, and more.
It uses the OpusScript library to handle the audio stream and the WebSocket library to connect to the Hume API.
- Clone the repository
- Run
npm install
- Copy .env.example to .env
- Fill out the .env with your Hume API key and Discord bot token
- Run
npm start
- Type
!join
in a text channel in your server and the bot will join the voice channel you are in - Type
!leave
for the bot to leave the voice channel
- Create an account at https://www.hume.ai/
- Create a new app and get your API key
- Go to Empathici Voice Interface -> Configurations and create a new configuration.
- Choose EVI 2
- Select a preset voice or custom voice
- Choose an LLM and System Prompt
- Give it a sensible name
- Copy the configuration ID and put it in the .env
- Go to https://discord.com/developers/applications
- Click "New Application"
- Give it a sensible name
- Go to the Bot tab
- Click "Add Bot"
- Copy the token and put it in the .env
- Go to the OAuth2 tab
- Select "bot" and "applications.commands" scopes
- Copy the URL and paste it into your browser to invite the bot to your server
- Copy the Client ID and put it in the .env
- Go to the Bot tab
- Click "Copy" to copy the token
- Paste it into the .env
- Ensure the bot has the permissions below
- The bot needs the intents Guilds, Guilds Voice States, Guild Messages, and Message Content
Ensure the bot has the following permissions in your Discord server:
- Connect
- Speak
- View Channels
- Send Messages
- Read Message History
- Use Voice Activity
You can set these permissions when inviting the bot to your server or by adjusting the bot's role permissions in your server settings.
- If the bot is not connecting to Hume, check that you have set the correct configuration ID in the .env
- The bot will play a sound when it recognises your message and again when it understands you, if you do not hear this sound it did not understand you
- You can interupt the bot, but please note after the sound its heard you it could take a few seconds to respond so be careful not to interupt it or things will get cut off, this is a limitation of voice bots right now
- The bot will timeout based on the Inactivity Timeout set in the configuration, it will attempt to reconnect