Skip to content
This repository has been archived by the owner on May 15, 2022. It is now read-only.
/ lavalink Public archive

An easy-to-use package for interacting with Lavalink with built-in Spotify and Deezer support.

License

Notifications You must be signed in to change notification settings

cryo-sphere/lavalink

Repository files navigation

@stereo-bot/lavalink

An easy-to-use package for interacting with Lavalink with built-in Spotify and Deezer support (plugins must be added to the plugins array in-order to work). based off Erela.js & Lavaclient

Version License: MIT Localized: Crowdin Discord


Install

yarn add / npm install @stereo-bot/lavalink

Usage

Extremely simple example

const { Client } = require("discord.js");
const { Manager, Deezer, Spotify } = require("@stereo/lavalink");

const client = new Client({ intents: ["GUILD_VOICE_STATES", "GUILD_MESSAGES", "GUILDS"] });
const manager = new Manager(nodes, options);

client.on("ready", () => {
	console.log("ready");
	manager.init(client.user.id);
});

client.ws.on("VOICE_STATE_UPDATE", (data) => manager.voiceStateUpdate(data));
client.ws.on("VOICE_SERVER_UPDATE", (data) => manager.voiceServerUpdate(data));

client.on("messageCreate", async (message) => {
	if (message.content.includes("-start")) {
    const song = message.content.replace("-start", "");
		const player = manager.create({ guild: message.guild.id });
		const song = (await player.search(song, message.author.id, "yt")).tracks[0];

    if (!song) return message.reply("no song found");

		player.queue.add(song);
		player.setVoice(message.member.voice.channelId);
		player.setText(message.channelId);

    message.reply(`Successfully enqueued ${song.title}`);

		player.connect();
		player.play();

	}
);

manager.on("socketConnect", (socket) => console.log(`Socket online: ${socket.options.id}`));
manager.on("socketError", ({ socket, error }) =>
	console.log(`Socket error (${socket.options.id}): ${error.message ?? error.stack}`)
);

client.login("token");

Author

👤 DaanGamesDG

Donate

This will always be open source project, even if I don't receive donations. But there are still people out there that want to donate, so if you do here is the link PayPal or to Ko-Fi. Thanks in advance! I really appriciate it <3

Lisence

Project is licensed under the © MIT License


About

An easy-to-use package for interacting with Lavalink with built-in Spotify and Deezer support.

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published