VoiceTest is a voice-enabled Discord bot built with Node.js and Discord.js. It captures live speech from users in a voice channel, streams it to OpenAI's GPT-4o-mini realtime API for transcription and AI response, then plays back synthesized voice responses—all in real time.
- Real-time voice-to-text transcription using OpenAI GPT-4o-mini realtime
- AI-generated voice responses streamed back into Discord
- High-quality audio encoding/decoding with
@purinton/resampler
and Prism-media - Modular command and event handler architecture via
@purinton/discord
- Multi-language/localized responses with built-in locale files
- Graceful startup, shutdown, and error handling via
@purinton/common
- Ready for Docker and systemd deployment
- Comprehensive Jest test suite covering locales, commands, and events
-
Clone this repository and install dependencies:
git clone https://github.com/purinton/voicetest.git cd voicetest npm install
-
Copy and configure your environment variables and instructions:
copy .env.example .env copy instructions.txt.example instructions.txt
- Fill in
DISCORD_TOKEN
,GUILD_ID
,VOICE_CHANNEL_ID
, andOPENAI_API_KEY
in.env
. - Edit instructions.txt to include any custom instructions for the voice agent.
- Fill in
-
Start the bot locally:
npm start # or node voicetest.mjs
All settings are managed via environment variables in .env
.
See .env.example
for required and optional keys.
- Invite your bot to a Discord server with the correct permissions.
- Join the configured voice channel.
- Speak into the channel—VoiceTest will transcribe your speech, send it to the AI, and play back the AI’s response automatically.
- Add new commands by placing a
.json
definition and.mjs
handler in thecommands/
directory.
- Add or modify event handlers in the
events/
directory. Handlers follow the Discord Gateway event names.
- Update or add locale files in the
locales/
directory. All responses and command metadata can be localized.
Build and run with Docker:
docker build -t voicetest .
docker run --env-file .env voicetest
-
Copy
voicetest.service
to/etc/systemd/system/voicetest.service
. -
Edit paths and user/group settings in the service file.
-
Reload and start:
sudo systemctl daemon-reload sudo systemctl enable voicetest sudo systemctl start voicetest
Run the full test suite:
npm test
For questions or feedback, join the Purinton Dev Discord.
MIT © 2025 Russell Purinton