1.0.0 • Published 2 years ago
mocylink v1.0.0
Table of contents
Installation
// Using npm
npm install mocylink
// Using yarn
yarn add mocylink
About
To use you need a configured Lavalink instance.
- Stable client
- 100% Compatible with Lavalink
- Object-oriented
- 100% Customizable
- Easy to setup
Implementation
Mocylink Music Example bot as guide for beginning.
Example usage basic bot
// main file
// Require both libraries
const { Client } = require("discord.js");
const { Mocylink } = require("mocylink");
// Initiate both main classes
const client = new Client();
// Define some options for the node
const nodes = [
{
host: "localhost",
password: "youshallnotpass",
port: 2333,
secure:false
}
];
// Assign Manager to the client variable
client.poru = new Mocylink(client,nodes);
// Emitted whenever a node connects
client.poru.on("nodeConnect", node => {
console.log(`Node "${node.name}" connected.`)
})
// Emitted whenever a node encountered an error
client.poru.on("nodeError", (node, error) => {
console.log(`Node "${node.name}" encountered an error`)
})
// Listen for when the client becomes ready
client.once("ready", () => {
client.poru.init(client;
console.log(`Logged in as ${client.user.tag}`);
});
// this event used to make connections upto date with lavalink
client.on("raw",async d => await client.poru.packetUpdate(d));
// Finally login at the END of your code
client.login("your bot token here");
// creating player
const player = await client.mocylink.createConnection({
guild: message.guild.id,
voiceChannel: message.member.voice.channel.id,
textChannel: message.channel,
selfDeaf: true,
selfMute: false,
})
// Getting tracks
const resolve = await client.mocylink.resolve('Ignite',"yt");
Need Help?
Feel free to join our discord server, Give us suggestions and advice about errors and new features. with ❤️ by JohnDavid .