Skip to content

CesiumLabs/chiro.js

Repository files navigation


discord.js


Discord server NPM version NPM downloads Patreon

About

Chiro.js is a powerful Node.js module that allows you to easily interact with the Nexus. Chiro.js is highly inspired from Erela.JS which is a module for lavalink.

Installation

Node.js 14.0.0 or newer is required.

npm install chiro.js

Example usage

const Discord = require("discord.js");
const Chiro = require("chiro.js");
const client = new Discord.Client();
const manager = new Chiro.Manager({    
    nodes: [{ host: "localhost", port: 3000, password: "SwagLordNitroUser12345", secure: true }],
    onData(id, payload) {
        const guild = client.guilds.cache.get(id);
        if (guild) guild.shard.send(payload);
    },
});

manager.on("ready", () => {
    console.log("Chiro manager is ready.");
});

manager.on("trackStart", (player, track) => {
    console.log(`${track.title} has started playing!`);
});

manager.on("error", console.log);

client.on("ready", () => {
    manager.init(client.user.id);
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on("message", async (message) => {
    if (message.content === "play") {
        const player = await manager.createPlayer({
            guild: message.guild.id,
            textChannel: message.channel.id,
            voiceChannel: message.member.voice.channel.id,
        });

        const response = await player.search({ query: "play that funky music" });
        player.queue.add(response.tracks[0]);
        await player.connect().then(p => p.play());
    }
});

client.on('raw', manager.updateVoiceState.bind(manager));

client.login("token");

Links

Help

If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction kindly create an github issue or join our official Chiro.js Support Server.

About

Official JavaScript Nexus client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •