Giter Site home page Giter Site logo

lavalink's Introduction

aoi.js-lavalink

aoi.js-lavalink is a package used to bring the functionality of lavalink to aoi.js fast and easy.

Installation

Get started by installing the latest version of this package within your project.

npm install github:faf4a/lavalink

Setup

To add the functionality to your client, we have to import the lavalinkManager class.

const { AoiClient, LoadCommands } = require("aoi.js");
const { lavalinkManager } = require("aoi.js-lavalink");

const client = new AoiClient({
  token: "DISCORD BOT TOKEN",
  prefix: "DISCORD BOT PREFIX",
  intents: ["MessageContent", "Guilds", "GuildMessages", "GuildVoiceStates"],
  events: ["onInteractionCreate", "onMessage"],
  database: {
    type: "aoi.db",
    db: require("@akarui/aoi.db"),
    dbType: "KeyValue",
    tables: ["main"],
    securityKey: "a-32-characters-long-string-here",
  },
});

const lavalink = new lavalinkManager(client, {
  host: "0.0.0.0", // Server Address
  port: 0000, // Server Port
  password: "youshallnotpass", // Lavalink Server Password
  secure: false, // HTTP/HTTPS protocol
  events: ["trackStart", "trackEnd"], // Array of events that can be used.
  // debug: true // Used to enable debugging, not pretty but could help to debug your issues.
});

// Adding events
lavalink.addEvent("trackStart", {
  code: `$log[Now playing $trackInfo[uri]!]`
});

(No lavalink server? https://lavalink.moebot.pro/non-ssl check this out!)

Events[^3]

Event Names Parameters Description
nodeCreate node Emitted once a node gets created
nodeConnect node Emits when a node connects
nodeReconnect node Emits when a node attempts a reconnect
nodeDisconnect node, reason: { code?: number, reason?: string } Emits when a node disconnects
nodeError node, error Emits when a node throws errors
nodeRaw payload Emits every payload from a Node
playerCreate player Emits when a player gets created
playerDestroy player Emits when a player gets destroyed
queueEnd player, track, payload Emits when the queue End
playerMove player, initChannel, newChannel Emits when the player moves from a Voice Channel to another one
playerDisconnect player, oldChannel Emits when the player Leaves the VC
trackStart player, track, payload Emits when a track starts to play
trackEnd player, track, payload Emits when a track ends playing
trackStuck player, track, payload Emits when a track gets stucked and skips the track
trackError player, track, payload Emits when a track errors and skips it
socketClosed player, payload Emits when a connection gets closed

lavalink's People

Contributors

faf4a avatar

Stargazers

 avatar

Watchers

 avatar

lavalink's Issues

[bug]: events

events die when added more than once

  1. trackStart added
  2. trackEnd added
  3. trackStart added

1st trackStart will be "forgotten"

breaks autoplay and filters

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.