1.0.2 • Published 4 years ago

@evolvejs/evolava v1.0.2

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
4 years ago

EvoLava

  • A simple Lavalink Client for EvolveJS

Setup

  • First of all you need to have NodeJS and EvolveJS installed...

  • Second you need to install Java (Note - You should install Java 13 as Lavalink has some problems with Java 11 and 14)

  • Download and install the latest version of Lavalink

Installation

npm i @evolvejs/evolava

Basic Startup

  • After you followed all the steps above, you can now initialize a new EvoLavaClient instance ONLY in Ready Event
  • Start the Lavalink CI server by the command java -jar Lavalink.jar in the directory where you installed lavalink, make sure to have a application.yml

Usage

const { EvoLavaClient } = require("@evolvejs/evolava");
const { EvolveBuilder, CacheOptions, GatewayIntent } = require("@evolvejs/evolvejs");

const client = new EvolveBuilder()
                    .setToken("")
                    .setShards(1)
                    .enableCache(CacheOptions.GUILD)
                    .enableIntents(
                        GatewayIntent.GUILD, GatewayIntent.GUILD_MESSAGES, GatewayIntent.VOICE_STATES
                        ).build();

client.on("clientReady", () => {
    client.music = new EvoLavaClient(client, [
        {
            host: "localhost",
            port: 2333,
            password: "youshallnotpass"
        }
        ]);
});

client.on("newMessage", (msg) => {
    if(msg.content == "play") {
        let player = client.music.spawn({
            guild: msg.guild,
            voiceChannel: msg.member.voiceState.channel,
            textChannel: msg.channel,
            volume: 100,
            self: {
                mute: false,
                deaf: true
            }
        }, {
            repeatTrack: false,
            repeatQueue: false,
            skipOnError: true
        });

        let song = player.search("Rick Astley - Never Gonna Give you up", msg.member, options: {
            source: "yt",
            add: false
        });

        if(!song) return;

        player.play();
    }
})

Support

Credits

  • Most of the logic of code was taken from LavaJS by the Projects.Me Team