mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Add internal support for @discordjs/opus to v11 (#3700)
* Add internal support for @discordjs/opus * Remove redundant try/catch * fix: use setBitrate method in @discordjs/opus * chore: tidy up opus imports * fix: correct imports for DiscordJsOpusEngine * chore: update docs to prefer @discordjs/opus * chore: bump prism-media to 0.0.4 to allow ffmpeg-static
This commit is contained in:
@@ -8,8 +8,8 @@ Update to Node.js 6.0.0 or newer.
|
||||
|
||||
## How do I get voice working?
|
||||
- Install FFMPEG.
|
||||
- Install either the `node-opus` package or the `opusscript` package.
|
||||
node-opus is greatly preferred, due to it having significantly better performance.
|
||||
- Install either the `@discordjs/opus` package or the `opusscript` package.
|
||||
@discordjs/opus is greatly preferred, due to it having significantly better performance.
|
||||
|
||||
## How do I install FFMPEG?
|
||||
- **npm:** `npm install ffmpeg-binaries`
|
||||
@@ -17,7 +17,7 @@ Update to Node.js 6.0.0 or newer.
|
||||
- **Ubuntu 14.04:** `sudo apt-get install libav-tools`
|
||||
- **Windows:** `npm install ffmpeg-binaries` or see the [FFMPEG section of AoDude's guide](https://github.com/bdistin/OhGodMusicBot/blob/master/README.md#download-ffmpeg).
|
||||
|
||||
## How do I set up node-opus?
|
||||
- **Ubuntu:** Simply run `npm install node-opus`, and it's done. Congrats!
|
||||
## How do I set up @discordjs/opus?
|
||||
- **Ubuntu:** Simply run `npm install @discordjs/opus`, and it's done. Congrats!
|
||||
- **Windows:** Run `npm install --global --production windows-build-tools` in an admin command prompt or PowerShell.
|
||||
Then, running `npm install node-opus` in your bot's directory should successfully build it. Woo!
|
||||
Then, running `npm install @discordjs/opus` in your bot's directory should successfully build it. Woo!
|
||||
|
||||
@@ -38,13 +38,13 @@ discord.js is a powerful [Node.js](https://nodejs.org) module that allows you to
|
||||
Ignore any warnings about unmet peer dependencies, as they're all optional.
|
||||
|
||||
Without voice support: `npm install discord.js`
|
||||
With voice support ([node-opus](https://www.npmjs.com/package/node-opus)): `npm install discord.js node-opus`
|
||||
With voice support ([@discordjs/opus](https://www.npmjs.com/package/@discordjs/opus)): `npm install discord.js @discordjs/opus`
|
||||
With voice support ([opusscript](https://www.npmjs.com/package/opusscript)): `npm install discord.js opusscript`
|
||||
|
||||
### Audio engines
|
||||
The preferred audio 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.
|
||||
The preferred audio engine is @discordjs/opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose @discordjs/opus.
|
||||
Using opusscript is only recommended for development environments where @discordjs/opus is tough to get working.
|
||||
For production bots, using @discordjs/opus should be considered a necessity, especially if they're going to be running on multiple servers.
|
||||
|
||||
### Optional packages
|
||||
- [bufferutil](https://www.npmjs.com/package/bufferutil) to greatly speed up the WebSocket when *not* using uws (`npm install bufferutil`)
|
||||
|
||||
@@ -7,12 +7,12 @@ To get started, make sure you have:
|
||||
* FFmpeg - `npm install ffmpeg-binaries`
|
||||
* an opus encoder, choose one from below:
|
||||
* `npm install opusscript`
|
||||
* `npm install node-opus`
|
||||
* `npm install @discordjs/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.
|
||||
The preferred opus engine is @discordjs/opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose @discordjs/opus.
|
||||
Using opusscript is only recommended for development environments where @discordjs/opus is tough to get working.
|
||||
For production bots, using @discordjs/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
|
||||
|
||||
Reference in New Issue
Block a user