0.0.16-alpha • Published 4 years ago

dislink v0.0.16-alpha

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Codacy Badge Gitpod Ready-to-Code Discord npm npm GitHub issues GitHub pull requests NPM

Dislink

So what is Dislink?

Dislink is a Lavalink Wrapper for Eris that aims to be fast, simple and easy. It has a built in queue system, equalizer and more!

Installing

It is recommended you install Dislink with yarn

$ yarn add dislink

Or with NPM

$ npm install dislink

First Steps

Setting up a Lavalink Server

So firstly, you of course need a Lavalink server installed on either your VPS or own PC. You can download Lavalink here. DO NOTE THAT LAVALINK REQUIRES A JRE OF 11 OR HIGHER! To get a JRE of 11 or higher, I do recommend using OpenJDK instead of Oracles JDK because to use their JDK in production, it requires a license. You can get OpenJDK here.

Next, you create an application.yml folder and put it in your base directory where you extracted the Lavalink Jar file. Your application.yml file should look something like this:

server: # REST and WS server
  port: 2333
  address: 0.0.0.0
lavalink:
  server:
    password: "youshallnotpass"
    sources:
      youtube: true
      bandcamp: false
      soundcloud: false
      twitch: false
      vimeo: false
      mixer: false
      http: true
      local: false
    bufferDurationMs: 400
    youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
    youtubeSearchEnabled: true
    soundcloudSearchEnabled: true
    gc-warnings: true
    #ratelimit:
      #ipBlocks: ["1.0.0.0/8", "..."] # list of ip blocks
      #excludedIps: ["...", "..."] # ips which should be explicit excluded from usage by lavalink
      #strategy: "RotateOnBan" # RotateOnBan | LoadBalance | NanoSwitch | RotatingNanoSwitch
      #searchTriggersFail: true # Whether a search 429 should trigger marking the ip as failing

metrics:
  prometheus:
    enabled: false
    endpoint: /metrics

sentry:
  dsn: ""
#  tags:
#    some_key: some_value
#    another_key: another_value

logging:
  file:
    max-history: 30
    max-size: 1GB
  path: ./logs/

  level:
    root: INFO
    lavalink: INFO

Feel free to leave everything as is, or you can customize it to however you want it to be. Do note, however that at the time of writing this, only YouTube works for LavaLink.

Now to run your Lavalink server all you have to do is

$ java -jar /path/to/Lavalink.jar

Setting up a bot

Alright enough of the boring part. Time to build the bot! So here is an example on how to connect to your Lavalink Server:

const Dislink = require("dislink")
const eris = require("eris")
const client = new eris.Client("BOT_TOKEN", {ERIS_OPTIONS})

client.on("ready", () => {
    const DislinkClient = new Dislink.DislinkClient(client, {host: "123.456.678.123", port: 2333, password:"youshallnotpass"}, {shards:client.shards.size, userID: "BOT_USERID"})
    
    DislinkClient.on("connected", () => {
        console.log("Connected!")
    })
    
    DislinkClient.on("error", (err) => {
        console.error(err)
    })
})

That is basically it! The rest of the documentation is on my github.io page here

Note: this project is still a very wip and not complete yet. Do give it some time for Relms to fully develop and add the queue system and so on. Thanks!

That is basically it! If you need any further help, do feel free to join my Discord Server here. It is where I post updates about my bot, Relms Bot and this library. Thanks and I hope to see you there.

0.0.16-alpha

4 years ago

0.0.15-alpha

4 years ago

0.0.10-alpha

4 years ago

0.0.9-alpha

4 years ago

0.0.14-alpha

4 years ago

0.0.13-alpha

4 years ago

0.0.7-alpha

4 years ago

0.0.6-alpha

4 years ago

0.0.4-alpha

4 years ago

0.0.2-alpha

4 years ago

0.0.3-alpha

4 years ago

0.0.5-alpha

4 years ago

0.0.1-alpha

4 years ago