zekroTJA / yuri

Best soundbot in whole North Korea! Supporting hotkeys and a web interface!
MIT License
13 stars 7 forks source link

Add Lavalink support #22

Open NNTin opened 5 years ago

NNTin commented 5 years ago

Issue Type

Application

Description

Add lavalink support. https://github.com/Frederikam/Lavalink (https://github.com/sedmelluq/lavaplayer) The current issue with Yuri is that you have to restart the bot after you've been running it for a while. It gets slower and slower. Lavalink should solve this problem. It's a proven solution used by Rythm, RedDiscord-Bot, Dyno, Fredboat, ... . It's a solution written in java but you can treat it as a blackbox. There are clients written in python, javascript, java, etc. . You download the .jar file and run the server with java -jar Lavalink.jar. Configuration of the lavalink server is done via application.yml. On your Discord Bot you connect to the lavalink server by providing the hostname, the port and the password.

The massive advantage is you have a really performant audio player with low memory footprint

zekroTJA commented 5 years ago

Hey, thank you verry much for the detailled description!

I had this solution in mind for a long time, but I think I will look into it as soon as posible. I think, it's not even a huge issue, that I need to start a seperate jar fiel as server, because I only use the bots application in a docker container.

zekroTJA commented 5 years ago

Okay, so far, I've implemented lavalink with discord.js-lavalink and its working, at least so far I've tested yet ^^ If you want to test it, take a look in the lavalink-integration branch.

Then, just add the following to your Yuri config:

"lavalink": {
    "host": "localhost",
    "port": "2333",
    "password": "<yourPw>"
}

If you use another server for Lavalink, just chanche the values, of course ^^

Also, you should change the path to your audio files in the config to an absolute path. Also, the files must be on the server of Yuri and of the Lavalink server, because Yuri is still checking for the sound files. This should be changed later, but I just wanted getting it working for now.

Also, I've noticed some issues with Non-ASCII characters as file names, maybe this could be solved by encoding the URI string...

Also, there are some timing problems with the event handling between Lavalink, Yuri and the web interface, which could lead to some laggy side effect on the front end.

NNTin commented 5 years ago

Awesome! Also, thank you. Also, 👍

😘

OBenned commented 5 years ago

I can vote for this too, I've tested the lavalink branch and it seems to run pretty smooth.

I haven't seen any lag noticeable yet, but i will get back to you i do

zekroTJA commented 5 years ago

I have noticed a problem that the bot will not play the sound if he is not in the voice channel and needs to join and play the sound after. Also, we have the problem, that round about 20 of our 500 sounds, are not able to be played in any way. It is not depending on the file format or the encoding, I think. But tbh I had not the time to look through the lavalink servers log last time ^^

But thank you for your testing :)