1.0.2 • Published 23 days ago

rainlink v1.0.2

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
23 days ago

🌦️ Rainlink

Another lavalink wrapper but focus on stability and rich features

🌟 Features

  • Stable client
  • Support TypeScript
  • 100% Compatible with Lavalink
  • Object-oriented
  • Easy to setup
  • Inbuilt Queue System
  • Extendable Player, Queue, Rest class
  • Backward compatible (Can run lavalink version 3.7.x)
  • Driver based (avaliable to run Nodelink v2 and port older lavalink version)
  • Plugin system
  • Using PWSL by The PerformanC Organization for better WS implementation

🛠️ Installation

npm i rainlink

📘 Document:

Here: https://rainlinkjs.vercel.app/

💿 Used by

NameCreatorVariants
ByteBlazeRainyXeonModded / Built in

If you want to add your own bot create a pull request with your bot added. Please add your full name.

➕ Plugins

This is the list of all rainlink plugin currently supported

NameTypeLinkAuthor
rainlink-nicoOfficialnpmjs / githubRainyXeon
rainlink-deezerOfficialnpmjs / githubRainyXeon
rainlink-appleOfficialnpmjs / githubRainyXeon
rainlink-spotifyOfficialnpmjs / githubRainyXeon
rainlink-voiceOfficialnpmjs / githubRainyXeon

⚙ Drivers

This is the list of all rainlink driver currently supported (codename is made up by me)

Driver NameVoice ServerLanguageSupported VersionCodenameNotes
lavalink/v4/koinuLavalinkJavav4.0.0 - v4.x.xkoinu
lavalink/v3/kotoLavalinkJavav3.0.0 - v3.7.xkotofilter and resume in lavalink below v3.4 not supported
nodelink/v2/nariNodelinkJavascriptv2.0.0 - v2.x.xnariSome filter mode in nodelink not supported
frequenc/v1/mikuFrequenCCIN TESTINGmikuThis driver is in testing so don't use it or you will have errors

📃 Migrtation logs:

0.9.2 -> 1.0.0

src/index.ts
- Plugin
- Plugin.VoiceReceiver
- Plugin.PlayerMoved
src/Interface/Constants.ts
- VoiceConnect = 'voiceConnect',
- VoiceDisconnect = 'voiceDisconnect',
- VoiceError = 'voiceError',
- VoiceStartSpeaking = 'voiceStartSpeaking',
- VoiceEndSpeaking = 'voiceEndSpeaking',
src/Plugin/RainlinkPlugin.ts
+ isRainlinkPlugin

0.9.0 -> 0.9.2

src/Node/RainlinkRest.ts
- getLavalinkInfo()
+ getInfo()

0.8.0 -> 0.9.0

src/Player/RainlinkPlayer.ts
- <RainlinkPlayer>.setFilter("nightcore")
+ <RainlinkPlayer>.filter.set()
+ <RainlinkPlayer>.filter

src/Interface/Constants.ts
+ RainlinkFilterMode

src/index.ts (Add new class)
+ RainlinkFilter

💾 Example bot:

const {Client, GatewayIntentBits} = require('discord.js');
const {Guilds, GuildVoiceStates, GuildMessages, MessageContent} = GatewayIntentBits;
const {Rainlink, Library} = require("rainlink");
const Nodes = [{
    name: 'owo',
    host: '192.168.0.66',
    port: 2333,
    auth: 'youshallnotpass',
    secure: false,
}];

const client = new Client({intents: [Guilds, GuildVoiceStates, GuildMessages, MessageContent]});
const rainlink = new Rainlink({
    library: new Library.DiscordJS(client),
    nodes: Nodes,
});

client.on("ready", () => console.log(client.user?.tag + " Ready!"));

rainlink.on('nodeConnect', (node) => console.log(`Lavalink ${node.options.name}: Ready!`));
rainlink.on('nodeError', (node, error) => console.error(`Lavalink ${node.options.name}: Error Caught,`, error));
rainlink.on("nodeClosed", (node) => console.warn(`Lavalink ${node.options.name}: Closed`))
// rainlink.on('debug', (name, info) => console.debug(`Lavalink ${name}: Debug,`, info));
rainlink.on('nodeDisconnect', (node, code, reason) => {
  console.warn(`Lavalink ${node.options.name}: Disconnected, Code ${code}, Reason ${reason || 'No reason'}`)
});

rainlink.on("trackStart", (player, track) => {
    client.channels.cache.get(player.textId).send({content: `Now playing **${track.title}** by **${track.author}**`})
});

rainlink.on("trackEnd", (player) => {
  client.channels.cache.get(player.textId).send({content: `Finished playing`})
});

rainlink.on("queueEmpty", player => {
    client.channels.cache.get(player.textId).send({content: `Destroyed player due to inactivity.`})
    player.destroy();
});

client.on("messageCreate", async msg => {
    if (msg.author.bot) return;

    if (msg.content.startsWith("!play")) {
        const args = msg.content.split(" ");
        const query = args.slice(1).join(" ");

        const {channel} = msg.member.voice;
        if (!channel) return msg.reply("You need to be in a voice channel to use this command!");

        let player = await rainlink.create({
            guildId: msg.guild.id,
            textId: msg.channel.id,
            voiceId: channel.id,
            shardId: 0,
            volume: 40
        })

        let result = await rainlink.search(query, {requester: msg.author});
        if (!result.tracks.length) return msg.reply("No results found!");

        if (result.type === "PLAYLIST") for (let track of result.tracks) player.queue.add(track);
        else player.queue.add(result.tracks[0]);


        if (!player.playing || !player.paused) player.play();

        return msg.reply({content: result.type === "PLAYLIST" ? `Queued ${result.tracks.length} from ${result.playlistName}` : `Queued ${result.tracks[0].title}`});
    }
})


client.login('');

✨ Special thanks

💫 Credits

1.0.2

23 days ago

1.0.1

24 days ago

1.0.0

27 days ago

0.9.4

27 days ago

0.9.3

1 month ago

0.9.2

1 month ago

0.9.1

1 month ago

0.9.0

1 month ago

0.8.10

1 month ago

0.8.9

2 months ago

0.8.8

2 months ago

0.8.7

2 months ago

0.8.6

2 months ago

0.8.5

2 months ago

0.8.4

2 months ago

0.8.3

2 months ago

0.8.1

2 months ago

0.8.2

2 months ago

0.8.0

2 months ago

0.7.3

2 months ago

0.7.2

2 months ago

0.7.1

2 months ago

0.7.0

2 months ago

0.6.2-beta5

2 months ago

0.6.4-beta5

2 months ago

0.6.1-beta5

2 months ago

0.6.3-beta5

2 months ago

0.6.0-beta5

2 months ago

0.5.6-beta4

2 months ago

0.5.5-beta4

2 months ago

0.5.4-beta4

2 months ago

0.5.3-beta4

2 months ago

0.5.2-beta4

3 months ago

0.5.1-beta4

3 months ago

0.4.1-beta3

3 months ago

0.5.0-beta4

3 months ago

0.3.1-beta2

3 months ago

0.3.2-beta2

3 months ago

0.4.0-beta3

3 months ago

0.3.3-beta2

3 months ago

0.3.0-beta2

3 months ago

0.2.10-beta

3 months ago

0.2.9-beta

3 months ago

0.2.6-beta

3 months ago

0.2.5-beta

3 months ago

0.2.3-beta

3 months ago

0.2.0-beta

3 months ago

0.2.1-beta

3 months ago

0.2.2-beta

3 months ago

0.0.12-alpha

3 months ago

0.1.0-beta

3 months ago

0.1.1-beta

3 months ago

0.1.2-beta

3 months ago

0.0.9-alpha

3 months ago

0.0.6-alpha

3 months ago

0.0.7-alpha

3 months ago

0.0.8-alpha

3 months ago

0.0.5-alpha

3 months ago

0.0.4-alpha

3 months ago

0.0.3-alpha

3 months ago

0.0.2-alpha

3 months ago

0.0.1-alpha

3 months ago