FerraLink Documents
  • 🐈Introduction
  • Getting Started
  • Classes
    • 😃FerraLink
      • Events (Shoukaku)
      • Events (FerraLink)
    • Node
    • Track
    • Filters
  • Type
    • FerralinkOptions
    • Resolve's result
Powered by GitBook
On this page
  • 1. Declaring FerraLink
  • 2. Defining your Nodes
  • 3. Set the Initilizer of Ferralink
  • 4. A small example to create play command.

Getting Started

Let us see how do we setup FerraLink

1. Declaring FerraLink

const { FerraLink } = require("ferra-link");

2. Defining your Nodes

  1. This step depends if you have any hosting to get your lavalink server.

  2. You can get your password from application.yml.

const nodes = [{
name: "Node",
url: "localhost:2333",
auth: "youshallpass",
secure: false
}];

3. Set the Initilizer of Ferralink

Creating in a way like the code example you can import the bot and nodes.

client.FerraLink = new FerraLink(client, nodes, {
spotify: {
 playlistLimit: "Playlist search limit here", //default limit is 5 = 500.
 albumLimit: "Album search limit here", //default limit is 5 = 500.
 artistLimit: "Artist search limit here", //default limit is 5 = 500.
 searchMarket: "searchMarket(ISO code) here", //default searchMarket is US.
 clientID: "Your spotify clientId here",
 clientSecret: "Your spotify clientSecret here"
}
});

4. A small example to create play command.

const player = await client.FerraLink.createPlayer({
guildId: message.guild.id,
voiceId: message.member.voice.channel.id,
textId: message.channel.id,
shardId: message.guild.shardId,
volume: 100,
deaf: true,
});

const resolve = await client.FerraLink.search(queue, { engine: "spsearch" }); // spsearch is work for search spotify tracks.
const { loadType, tracks, playlistInfo } = resolve;

if (loadType === "NO_MATCHES" || !tracks.length) return;

if (loadType === "PLAYLIST_LOADED") {
for (const track of tracks) {
player.queue.add(track);
}
if (!player.queue.current && !player.paused) await player.play();
message.channel.send({content: `Added ${player.queue.length} tracks from ${playlistInfo.name}`});
} else if (loadType === "SEARCH_RESULT" || loadType === "TRACK_LOADED") {
player.queue.add(tracks[0]);
if (!player.queue.current && !player.paused) await player.play();
message.channel.send({content: `Queued ${tracks[0].info.title}`});
} else return;

PreviousIntroductionNextFerraLink

Last updated 2 years ago