A simple but powerful Lavalink client with amazing features
- Stable.
- ESM & CommonJS supported.
- Updated for Lavalink v4.
- A example bot as guide for beginners.
- If you have any issues, please join our support server.
- Dev:
npm i https://github.com/vkamsingh/Ferralink-Dev.git
- Stable:
npm i npm i ferra-link
import { FerraLink } from 'ferra-link';
const { FerraLink } = require("ferra-link");
Set the Initilizer of Ferralink.
const { Client } = require("discord.js");
const { FerraLink, Connectors } = require("ferra-link");
const client = new Client({....});
client.FerraLink = new FerraLink({
nodes: [{
name: "Lavalink",
url: "localhost:2333",
auth: "youshallpass",
secure: false
}],
shoukakuoptions: {
moveOnDisconnect: false,
resumable: false,
resumableTimeout: 60,
reconnectTries: 10,
restTimeout: 60000
},
defaultSearchEngine: "spsearch",
}, new Connectors.DiscordJS(client));
client.login("token");
create a player to join voice channel.
const player = await client.FerraLink.createPlayer({
guildId: interaction.guild.id,
voiceId: interaction.member.voice.channel.id,
textId: interaction.channel.id,
shardId: interaction.guild.shardId,
volume: 100,
deaf: true,
});
To search tracks and define LoadType (LoadType will be import from Shoukaku).
const { LoadType } = require('shoukaku');
//search track from player.
const resolve = await player.search('love nawantiti', { engine: 'spsearch' });
//When tracks will not find it will return LoadType empty.
if (!resolve || [LoadType.ERROR, LoadType.EMPTY].includes(resolve.loadType)) return interaction.followUp({ content: "No match songs result found!" });
//LoadTypes for playlist, search and track.
if (resolve.loadType === LoadType.PLAYLIST) {
for (const track of resolve.data.tracks) {
player.queue.add(track, { requester: interaction.user });
}
} else if (resolve.loadType === LoadType.SEARCH) {
player.queue.add(resolve.data[0], { requester: interaction.user });
} else {
player.queue.add(resolve.data, { requester: interaction.user });
}
// To play track after search tracks.
if (!player.playing && !player.paused) await player.play();
some basic methods.
// There are 3 kinds of methods you can set volume.
player.setVolume(100);
await player.shoukaku.setGlobalVolume(100);
await player.shoukaku.setFilterVolume(1.0) // 1.0 = 100;
// To set custom text channel and voice channel.
player.setTextChannel(channelId);
player.setVoiceChannel(channelId);
// There are 2 kind of methods you can set search.
player.search('love nawantiti'); // it will be search from defaultSearchEngine.
player.search('love nawantiti', { engine: 'scsearch' }); // it will search from engine you defined here not from defaultSearchEngine.
// To get node for stats, custom functions etc.
player.shoukaku.getIdealNode();
You can access event with the help of
client.FerraLink.shoukaku.on(...)
.
Event Name | Elements | Description |
---|---|---|
ready | name, resumed | Event of the node connection. |
error | name, error | Event of the node error. |
close | name, code, reason | Event of the node close. |
disconnect | name, players, move | Event of the node disconnect. |
debug | name, reason | Event of the node debug. |
You can access event with the help of
client.FerraLink.on(...)
.
Event Name | Elements | Description |
---|---|---|
trackStart | player, track | Event of the track start. |
trackEnd | player, track | Event of the track end. |
queueEnd | player | Event of the queue end. |
playerClosed | player, data | Event of the player close. |
trackException | player, data | Event of the track exception. |
playerUpdate | player, data | Event of the player update. |
trackStuck | player, data | Event of the track stuck. |
trackError | player, error | Event of the track error. |
playerResumed | player | Event of the player resumed. |
playerDestroy | player | Event of the player destroyed. |
playerCreate | player | Event of the player create. |
Deivu as the owner of Shoukaku.
Vkamsingh, Corgi as the owner of FerraLink.