Table of Contents
- A JavaScript wrapper for the Lavalink audio client for Discord. Only supports Lavalink v3.
- This is a derivative work of lavalink.js, this wouldn't be possible without the author's work.
yarn add @skyra/audio
# or npm install @skyra/audio
const { Node } = require('@skyra/audio');
const node = new Node(
{
// Your Lavalink password:
password: '',
// The user ID of your bot:
userID: '',
// The total number of shards that your bot is running (optional, useful if you're load balancing):
shardCount: 0,
// A URL to your lavalink instance without protocol (optional, can be used instead of specifying hosts option):
host: '',
// Alternatively, define a custom rest and ws host links:
hosts: {
// The http host of your lavalink instance (optional):
rest: '',
// The ws host of your lavalink instance (optional):
ws: ''
}
},
(guildID, packet) => {
const guild = client.guilds.cache.get(guildID);
if (guild) return guild.shard.send(packet);
}
);
await node.connect();
// This sends the required raw Voice State and Voice Server data to lavalink so it can make a connection.
client.ws.on('VOICE_STATE_UPDATE', async (data) => {
try {
await node.voiceStateUpdate(data);
} catch (error) {
console.error(error);
}
});
client.ws.on('VOICE_SERVER_UPDATE', async (data) => {
try {
await node.voiceServerUpdate(data);
} catch (error) {
console.error(error);
}
});
import { Node } from '@skyra/audio';
// Same as before
Copyright © 2020, Skyra Project. Released under the MIT License.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request!
Skyra Project is open source and always will be, even if we don't get donations. That said, we know there are amazing people who may still want to donate just to show their appreciation. Thanks you very much in advance!
We accept donations through Patreon, BitCoin, Ethereum, and Litecoin. You can use the buttons below to donate through your method of choice.
Donate With | QR | Address |
---|---|---|
Patreon | Click Here | |
PayPal | Click Here | |
BitCoin | 3JNzCHMTFtxYFWBnVtDM9Tt34zFbKvdwco | |
Ethereum | 0xcB5EDB76Bc9E389514F905D9680589004C00190c | |
Litecoin | MNVT1keYGMfGp7vWmcYjCS8ntU8LNvjnqM |
Thanks goes to these wonderful people (emoji key):
Antonio Román 💻 |
Jeroen Claassens 💻 🚇 🚧 |
This project follows the all-contributors specification. Contributions of any kind welcome!