Shoukaku
The ShipGirl Project. Shoukaku (c) Kancolle for Shoukaku
A Full Blown Lavalink Wrapper designed around Discord.js v12
Currently being used by Kashima
Documentation
https://deivu.github.io/Shoukaku/?api
Installation
For Stable
npm i shoukaku
For Master
npm i Deivu/Shoukaku
Support Server
If you need help on using this, Join Here ShipGirls Community and ask at #support
.
Issue / Bug Found?
Feel free to open an issue in the Issues section of this repository.
Notes
If you want to help in development, you can use the wrapper and report the issues you experienced on using it, or Submit a PR if you think you can improve something.
There is a Discord.JS actual implementation and a simple implementation examples below.
Task List
Discord.js actual implementation.
View Kongou's Source Code Here
More simple implementation w/o queue.
const { Client } = require('discord.js');
const { Shoukaku } = require('shoukaku');
const MyLavalinkServer = [
{
name: 'my_lavalink_server',
host: 'localhost',
port: 6969,
auth: 'owo_your_password'
}
];
const client = new Client();
const Carrier = new Shoukaku(client, {
resumable: false,
resumableTimeout: 30,
reconnectTries: 2,
restTimeout: 10000
});
Carrier.on('ready', (name) => console.log(`Lavalink Node: ${name} is now connected`));
Carrier.on('error', (name, error) => console.log(`Lavalink Node: ${name} emitted an error.`, error));
Carrier.on('close', (name, code, reason) => console.log(`Lavalink Node: ${name} closed with code ${code}. Reason: ${reason || 'No reason'}`));
client.on('ready', () => {
Carrier.build(MyLavalinkServer, { id: client.user.id });
console.log('Bot Initialized');
})
client.on('message', async (msg) => {
if (msg.author.bot || !msg.guild) return;
if (msg.content.startsWith('$play')) {
if (Carrier.getLink(msg.guild.id)) return;
const args = msg.content.split(' ');
if (!args[1]) return;
const node = Carrier.getNode();
let data = await node.rest.resolve(args[1]);
if (!data) return;
if (Array.isArray(data)) data = data[0];
const link = await node.joinVoiceChannel({
guildID: msg.guild.id,
voiceChannelID: msg.member.voice.channelID
});
link.player.on('end', (reason) => {
console.log(reason);
link.disconnect();
});
link.player.on('exception', console.error);
link.player.on('stuck', (reason) => {
console.warn(reason);
link.disconnect();
});
link.player.on('voiceClose', (reason) => {
console.log(reason);
link.disconnect();
});
link.player.on('nodeDisconnect', () => {
link.disconnect();
})
await link.player.playTrack(data.track);
await msg.channel.send("Now Playing: " + data.info.title);
}
})
client.login('token');