Introduction

"Voice" refers to the ability of a bot to send audio in voice channels. discord.js makes it easy for you to get up and running with voice!

Quick example

async function play(voiceChannel) {
	const connection = await voiceChannel.join();
	connection.play('audio.mp3');
}
1
2
3
4

Installing dependencies

At the bare minimum, you'll need:

You may also choose to install the following dependencies.

TIP

Outside a development environment, it is recommended for you to use @discordjs/opus and sodium to improve performance and improve the stability of audio playback!

If you're struggling to install these dependencies, make sure you have build tools installed first. On Windows, this is as easy as running npm install --global --production --vs2015 --add-python-to-path windows-build-tools!