Skip to main content
Version: v2.6.1

Getting started




danger

🚨 THIS DOCUMENTATION IS FOR VERSION =<2.6.1. WE RECOMMEND USING THE LATEST VERSION FOR SUPPORT REASONS. WE ALSO WARN THAT THIS OLDER DOCUMENTATION MAY NOT BE COMPLETE OR POORLY READABLE.




Welcome to Magmastream's documentation! Magmastream is a fork of Erela.Js. This fork is powerful and contains a lot of tweaks.

>  npm install magmastream
danger

⚠️ Magmastream has dropped support for lavalink version 3.x.x.

tip

✅ Magmastream only supports lavalink version 4.

Basics

The first place to start with Magmastream is the Manager class.

index.js
    // Require both libraries
const { Client } = require('discord.js');
const { Manager } = require('magmastream');

// Initiate both main classes
const client = new Client();

// Define some options for the node
const nodes = [
{
host: '127.0.0.1',
identifier: 'Node 1',
password: 'somepassword',
port: 25033,
retryAmount: 1000,
retrydelay: 10000,
resumeStatus: true, // default: false,
resumeTimeout: 1000,
secure: false, // default: false
},
];

// Assign Manager to the client variable
client.manager = new Manager({
// The nodes to connect to.
nodes,
// Method to send voice data to Discord
send: (id, payload) => {
const guild = client.guilds.cache.get(id);
// NOTE: FOR ERIS YOU NEED JSON.stringify() THE PAYLOAD
if (guild) guild.shard.send(payload);
},
});

// Emitted whenever a node connects
client.manager.on('nodeConnect', (node) => {
console.log(`Node "${node.options.identifier}" connected.`);
});

// Emitted whenever a node encountered an error
client.manager.on('nodeError', (node, error) => {
console.log(`Node "${node.options.identifier}" encountered an error: ${error.message}.`);
});

// Listen for when the client becomes ready
client.once('ready', () => {
// Initiates the manager and connects to all the nodes
client.manager.init(client.user.id);
console.log(`Logged in as ${client.user.tag}`);
});

// THIS IS REQUIRED. Send raw events to Magmastream
client.on('raw', (d) => client.manager.updateVoiceState(d));

// Finally login at the END of your code
client.login('your bot token here');