Options
All
  • Public
  • Public/Protected
  • All
Menu

@skyra/audio

@skyra/audio

GitHub codecov npm npm bundle size minified (scoped)

Table of Contents

About

  • 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.

Installation and Usage

Package managers

yarn add @skyra/audio
# or npm install @skyra/audio

Usage

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

Meta

License

Copyright © 2020, Skyra Project. Released under the MIT License.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request!

Buy us some doughnuts

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 ![PatreonImage][] Click Here
PayPal ![PayPalImage][] Click Here
BitCoin ![BitcoinImage][] 3JNzCHMTFtxYFWBnVtDM9Tt34zFbKvdwco
Ethereum ![EthereumImage][] 0xcB5EDB76Bc9E389514F905D9680589004C00190c
Litecoin ![LitecoinImage][] MNVT1keYGMfGp7vWmcYjCS8ntU8LNvjnqM

Contributors ✨

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!

Generated using TypeDoc