0.4.9 โ€ข Published 6 months ago

ferra-link v0.4.9

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Discord npm version npm download GitHub issues

๐ŸŽถ FerraLink

A Simple but powerful Lavalink Client for your JavaScript Discord Bot!

๐Ÿ”จ Requirements

  • Node.js >= 16.9.0 or Latest.
  • Discord.js >= 14.6.0.

๐Ÿ“– Documentation

๐Ÿ“‚ Implementation

๐Ÿ“ฆ How to Install FerraLink

Dev: "npm i https://github.com/vkamsingh/Ferralink-Dev.git" //Dev version supports lavalink v4. https://github.com/vkamsingh/Ferralink-Dev#how-to-setup-our-ferralink
Stable: "npm i npm i ferra-link"

How to Setup our FerraLink

Set the Initilizer of Ferralink

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

const { Client, GatewayIntentBits } = require("discord.js");
const { FerraLink } = require("ferra-link");
const { Connectors } = require("shoukaku");

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.MessageContent
    ],
});


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
    },
    spotify: [{
        ClientID: "Your spotify clientId here",
        ClientSecret: "Your spotify clientSecret here"
    }],
    defaultSearchEngine: "FerralinkSpotify",
}, new Connectors.DiscordJS(client));

client.login("token");

A small example to create play command.

module.exports = {
   name: "play",
   aliases: ["p"],
   run: async (client, message, args) => {
   
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 player.search(args.join(" "));
const { loadType, tracks, playlistInfo } = resolve;

if (loadType === "NO_MATCHES" || !tracks.length) return message.reply({content: "No match songs result found!"});

if (loadType === "PLAYLIST_LOADED") {
    for (const track of tracks) {
        player.queue.add(track, { requester: message.author });
    }
    if (!player.playing && !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], { requester: message.author });
    if (!player.playing && !player.paused) await player.play();
    message.channel.send({ content: `Queued ${tracks[0].info.title}` });
} else return;
  }
}

Getting the Events (shoukaku)

You can access event with the help of client.FerraLink.shoukaku.on().....

Event NameElementsDescription
readyname, resumedEvent of the node connection.
errorname, errorEvent of the node error.
closename, code, reasonEvent of the node close.
disconnectname, players, moveEvent of the node disconnect.
debugname, reasonEvent of the node debug.

Getting the Events (FerraLink)

You can access event with the help of client.FerraLink.on().....

Event NameElementsDescription
trackStartplayer, trackEvent of the track start.
trackEndplayer, trackEvent of the track end.
queueEndplayerEvent of the queue end.
PlayerClosedplayer, dataEvent of the player close.
trackExceptionplayer, dataEvent of the track exception.
PlayerUpdateplayer, dataEvent of the player update.
trackStuckplayer, dataEvent of the track stuck.
trackErrorplayer, errorEvent of the track error.
PlayerResumedplayerEvent of the player resumed.
PlayerDestroyplayerEvent of the player destroyed.
PlayerCreateplayerEvent of the player create.

Donations ๐Ÿงก๐Ÿงก

You can donate to us to improve our project!

"Buy Me A Coffee"

Contributors

Deivu as the owner of Shoukaku.

Vkamsingh, Corgi as the owner of FerraLink.

Prahar as the maintainer of FerraLink Docs.

Inspired by kazagumo, Poru and erela.js.

0.4.9

6 months ago

0.4.8

11 months ago

0.4.7

11 months ago

0.3.9

1 year ago

0.4.5

1 year ago

0.4.4

1 year ago

0.4.6

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.3.8

1 year ago

0.3.7

1 year ago

0.3.6

1 year ago

0.3.56

1 year ago

0.3.55

1 year ago

0.3.52

1 year ago

0.3.51

1 year ago

0.3.5

1 year ago

0.3.4

1 year ago

0.3.33

1 year ago

0.3.32

1 year ago

0.3.31

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

2 years ago

0.2.85

2 years ago

0.2.82

2 years ago

0.2.81

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago