The goal of this library is to abstract away obvious steps involved in the process of acting as an intermediary between Lavalink and Discord to give developers a cleaner yet intuitive interface to work with.
- Built-in queue system
- Automatic player relocation
- Built-in custom plugin support
- Automatic relevant-node selection
- Runtime - one of the following:
- Library - any gateway client that supports:
- sending raw payloads over the connection
- receiving raw payloads from the connection
- Lavalink - at least with the following configuration:
- disabled local tracks - for unique track identifiers
- disabled built-in youtube source utilising their plugin instead (recommended)
Any gateway client library meeting the requirements above is supported, you can apply the following pseudocode (this is the basic approach):
import { Client } from "main-lib";
import { Player } from "discolink";
const client = new Client(...);
const player = new Player({
nodes: [], // add your nodes
async forwardVoiceUpdate(guildId, payload) {
// send the given payload to your gateway connection
client.guilds.cache.get(guildId).shard.send(payload);
}
});
client.on("raw", (payload) => {
// call the handler on gateway dispatch
player.voices.handleDispatch(payload);
});
client.login();- Handle track end reasons other than
cleanupandfinishedmanually - Always check for
reconnectingorchangingNodewhen handling voice states
