docs: (backport) Bring the main doc pages up to date, and add more examples (#2094)

This commit is contained in:
Isabella
2018-04-26 01:13:44 -05:00
parent feb0991c46
commit d7e7803178
11 changed files with 390 additions and 36 deletions

View File

@@ -4,12 +4,16 @@ Voice in discord.js can be used for many things, such as music bots, recording o
In discord.js, you can use voice by connecting to a `VoiceChannel` to obtain a `VoiceConnection`, where you can start streaming and receiving audio.
To get started, make sure you have:
* ffmpeg - `npm install ffmpeg-binaries`
* FFmpeg - `npm install ffmpeg-binaries`
* an opus encoder, choose one from below:
* `npm install opusscript`
* `npm install node-opus`
* a good network connection
The preferred opus engine is node-opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose node-opus.
Using opusscript is only recommended for development environments where node-opus is tough to get working.
For production bots, using node-opus should be considered a necessity, especially if they're going to be running on multiple servers.
## Joining a voice channel
The example below reacts to a message and joins the sender's voice channel, catching any errors. This is important
as it allows us to obtain a `VoiceConnection` that we can start to stream audio with.