# Getting Started

### 1. Declaring FerraLink

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

### 2. Defining your Nodes

{% hint style="info" %}

1. This step depends if you have any hosting to get your lavalink server.
2. You can get your password from `application.yml.`
   {% endhint %}

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

### 3. Set the Initilizer of Ferralink

{% hint style="info" %}
*Creating in a way like the code example you can import the bot and nodes.*
{% endhint %}

```javascript
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.

```javascript
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;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ferralink.gitbook.io/docs/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
