SudhanPlayz / Discord-MusicBot

An advanced discord music bot, supports Spotify, Soundcloud, YouTube with Shuffling, Volume Control and Web Dashboard with Slash Commands support!
https://musicbot.darrenofficial.com
Other
2.96k stars 2.88k forks source link

feature/DJSv14 #1227

Closed brianferri closed 11 months ago

brianferri commented 1 year ago

Please describe the changes this PR makes and why it should be merged: Implements DJSv14. Contains Major changes, will be going up as a separate version Read: https://github.com/SudhanPlayz/Discord-MusicBot/discussions/1225 https://github.com/SudhanPlayz/Discord-MusicBot/discussions/1223

The code has been almost completely refactored, keeping the same basic structure but reorganizing the Libraries, adding functionality and modularity. The bot has also been (optionally) containerized, using docker compose contexts, allowing the bot to be developed on any platform.

Tasks:

v5.1 Beta

Implemented features:

v5.2 Beta

v5.3 Full release

Future updates:

v6.0:

if anyone has suggestions reply to this or create a thread/discussion

PR Status

Status and versioning classification:

The update is ready to be merged whenever

DarrenOfficial commented 1 year ago

I think we should create a new branch for this, then push to master v5 once completed.

LewdHuTao commented 1 year ago

So how do you want to add Spotify, Apple Music and Deezer plugins?

I have a few options:

  1. Use LavaSrc (tested in my bot that using shoukaku and kazagumo, i can confirm its pretty good)
  2. Use kazagumo and shoukaku to add spotify and deezer plugins (stone deezer)
  3. Implements own plugins manager which pretty complicated
Neko-Life commented 1 year ago

Good idea. Perfect opportunity for ts rewrite

brianferri commented 1 year ago

@Neko-Life

Good idea. Perfect opportunity for ts rewrite

unfortunately I had already started with JS. probably gonna have to ask someone to help with that later on. I've been trying to keep track of all the typings in the meanwhile but I have noticed how much easier it would be if we actually had a TS bot instead. Once this base version is done I'll see to start implementing a proper TS version for the bot

brianferri commented 1 year ago

Note: this will go up as 5.1

brianferri commented 1 year ago

Scylla was added in 26a57fb but will be switched out for a PostgreSQL DB with Prisma ORM

brianferri commented 1 year ago

Scylla was added in 26a57fb but will be switched out for a PostgreSQL DB with Prisma ORM

Prisma supports different DB architectures, mostly SQL, but also MongoDB. Postgresql will be the provided db by default but documentation will be provided for configuration of your own DB

C-EO commented 1 year ago

Will this still be hostable on Replit or shall we have to do on-site hosting?

brianferri commented 1 year ago

Will this still be hostable on Replit or shall we have to do on-site hosting?

I haven't tested it on any deployment ready services and i don't recommend replit anyway.

The bot runs on anything that supports docker or that is docker configurable so you're free to test it however you like. If you're interested in just the bot (without DB and playlist command) then you can extract the djs-bot folder and use that directly, as it is completely modular and separable from the docker compose structure.

brianferri commented 1 year ago

Will this still be hostable on Replit or shall we have to do on-site hosting?

I haven't tested it on any deployment ready services and i don't recommend replit anyway.

The bot runs on anything that supports docker or that is docker configurable so you're free to test it however you like. If you're interested in just the bot (without DB and playlist command) then you can extract the djs-bot folder and use that directly, as it is completely modular and separable from the docker compose structure.

I know this might be a half solution but you could try the method described in this forum post:

https://replit.com/talk/ask/How-to-install-Docker/39255

C-EO commented 1 year ago

@BioCla The new Replit uses NixOS. That means that Docker can't be used because they phased it out. Before, Replit used to be a gigantic Docker container with many Docker instances running. Since it now uses Nix, I can't use the Docker option. I do not want the DB functionality, that's why I'm asking whether this new version of the bot supports Replit?

brianferri commented 1 year ago

@BioCla The new Replit uses NixOS. That means that Docker can't be used because they phased it out. Before, Replit used to be a gigantic Docker container with many Docker instances running. Since it now uses Nix, I can't use the Docker option. I do not want the DB functionality, that's why I'm asking whether this new version of the bot supports Replit?

If you're interested in just the bot (without DB and playlist command) then you can extract the djs-bot folder and use that directly, as it is completely modular and separable from the docker compose structure.

yes... If you want to set it up yourself

brianferri commented 1 year ago

v5.1 now has the dashboard as well, matching v5.0. v5.1 now enters it's official beta period.

Upcoming features: Playing from playlists saved on DB DJ Roles dedicated music channels with controller (maybe)??? and more...

if anyone has suggestions reply to this or create a thread/discussion

sprucecellodev125 commented 1 year ago

@BioCla The new Replit uses NixOS. That means that Docker can't be used because they phased it out. Before, Replit used to be a gigantic Docker container with many Docker instances running. Since it now uses Nix, I can't use the Docker option. I do not want the DB functionality, that's why I'm asking whether this new version of the bot supports Replit?

nonono, It's running Ubuntu (ewww), and yes it have Nix as package manager instead. However if you put pkgs.docker in replit.nix deps, it installs Docker but doesn't make Docker working properly. Since Replit doesn't give you root access, I think you should configure rootless docker (pain)

ghost commented 1 year ago

Hey mate and maintainers :)

I might be misunderstanding something, but according to this readme, it seems I can't configure my own Lavalink server, only the one preconfigured in the docker-compose.yml example.

It would be awesome, if you could make it a Docker ENV, so you could choose your own, since I have mine hosted behind a reverse proxy, and I would like it to keep it that way, instead of using the "default" docker.lavalink.

brianferri commented 1 year ago

@vp-en

Hey mate and maintainers :)

I might be misunderstanding something, but according to this readme, it seems I can't configure my own Lavalink server, only the one preconfigured in the docker-compose.yml example.

It would be awesome, if you could make it a Docker ENV, so you could choose your own, since I have mine hosted behind a reverse proxy, and I would like it to keep it that way, instead of using the "default" docker.lavalink.

as stated in the main README.md:

If you don't want a particular service to start up on make up you can simply comment the block for the service you want to remove from the docker-compose.yml file

This implies that you can indeed remove the lavalink service if it doesn't suit your needs but you would still need to modify the appropriate node configuration in the config.js file under the djs-bot directory

ghost commented 1 year ago

Ah cool, so there'll still be a config.js file with the option(s), then it's all good. Thanks mate <3

C-EO commented 1 year ago

@BioCla One of the reasons I liked v5 is because it had buttons. It would be pointless to create a v5.1 without buttons

The player needs the buttons for they simplified the work in addition to the pause, play, stop, and volume commands

brianferri commented 1 year ago

@C-EO

@BioCla One of the reasons I liked v5 is because it had buttons. It would be pointless to create a v5.1 without buttons

The player needs the buttons for they simplified the work in addition to the pause, play, stop, and volume commands

I'll take that as a suggestion. I was already planning on reimplementing them under a different dress: Instead of having it be on the player message itself it would be in a dedicated channel (kinda like hydra).

I'll try to reimplement it as you suggested as well

C-EO commented 1 year ago

@BioCla I know right now I might sound like pushing too much, but the lyrics command doesn't return the lyrics for a song that is longer 4096 chars.

Ideally it should return them but say "Truncated...."

brianferri commented 1 year ago

@C-EO

@BioCla I know right now I might sound like pushing too much, but the lyrics command doesn't return the lyrics for a song that is longer 4096 chars.

Ideally it should return them but say "Truncated...."

Thanks for letting me know, I'll fix it as soon as possible. It used to already be as you said but it seems it got reimplemented somewhere along the restructuring of the command

C-EO commented 1 year ago

Thanks

Slacker101 commented 1 year ago

@BioCla Just tried to run by editing .env files and compose based on the dist examples. Got one error.

FrontEnd / Dashboard

ready - started server on 0.0.0.0:3000, url: http://localhost:3000 error - ./node_modules/@react-aria/grid/nodemodules/@internationalized/date/dist/import.mjs:1:0 Module not found: Can't resolve '@swc/helpers//_class_private_field_init'

Import trace for requested module: ./node_modules/@react-aria/grid/node_modules/@react-aria/i18n/dist/real-module.mjs ./node_modules/@react-aria/grid/node_modules/@react-aria/i18n/dist/import.mjs ./node_modules/@react-aria/grid/dist/import.mjs ./node_modules/@react-aria/table/dist/module.js ./node_modules/@nextui-org/react/esm/table/table.js ./node_modules/@nextui-org/react/esm/table/index.js ./node_modules/@nextui-org/react/esm/index.js ./pages/_app.tsx

I did not modify any of the frontend code.

Edit "next": "13.4.4" seems to solve the above, though now I can't get discord logins to work.

Though I can't get login to work. Instead login redirects to /api/login with a 404 error

brianferri commented 1 year ago

@BioCla Just tried to run by editing .env files and compose based on the dist examples. Got one error.

FrontEnd / Dashboard

ready - started server on 0.0.0.0:3000, url: http://localhost:3000 error - ./node_modules/@react-aria/grid/nodemodules/@internationalized/date/dist/import.mjs:1:0 Module not found: Can't resolve '@swc/helpers//_class_private_field_init'

Import trace for requested module: ./node_modules/@react-aria/grid/node_modules/@react-aria/i18n/dist/real-module.mjs ./node_modules/@react-aria/grid/node_modules/@react-aria/i18n/dist/import.mjs ./node_modules/@react-aria/grid/dist/import.mjs ./node_modules/@react-aria/table/dist/module.js ./node_modules/@nextui-org/react/esm/table/table.js ./node_modules/@nextui-org/react/esm/table/index.js ./node_modules/@nextui-org/react/esm/index.js ./pages/_app.tsx

I did not modify any of the frontend code.

Edit "next": "13.4.4" seems to solve the above, though now I can't get discord logins to work.

Though I can't get login to work. Instead login redirects to /api/login with a 404 error

@Slacker101 thanks for the report, can you please make an issue for this as well? Explaining how to reproduce the problem, maybe putting screenshots and code snippets? I'll look into it as soon as I can from what I gathered here

brianferri commented 1 year ago

Edit "next": "13.4.4" seems to solve the above, though now I can't get discord logins to work.

Though I can't get login to work. Instead login redirects to /api/login with a 404 error

@Slacker101 The packages have been updated to the latest version. While I wasn't able to replicate your bug I'm hopeful that the fix you suggested sticks for you. Furthermore, the login 404 error you are getting is normal. The dashboard is not fully implemented yet and just displays a few mocked examples of future features

brianferri commented 1 year ago

Thanks

@C-EO The truncation of the lyrics was actually already implemented but the scope of the editing was happening after the set of the embed description, causing issues. This has been fixed in the latest commit

ghost commented 1 year ago

I seem to have mine working somewhat :). The bot works, loads and plays music.

But when I go to my dashboard, it gives me this error: Unhandled Runtime Error

TypeError: param is undefined

Source: utils/data.ts (21:30) @ getData/</commands<

  19 | let commands = await (apiCall("GET", "/commands", {
  20 |     method: "GET"
> 21 | })).then(async ({data}) => {
     |                      ^
  22 |     return await data;
  23 | });
  24 | resolve(await commands)

Image of the error: https://i.imgur.com/Of58v5I.png

Docker Compose, with stuff redacted: https://paste.ec/paste/5baGzWAl#u-i6fk4vyuBB7B9r33+8WesZnqLaDsYIyexCeEgflFr

Also, on an unrelated note.. There seems to be a few settings missing from config.js, that the v5.0 had in their config.js. Specifically missing the autoQueue, 247 features 😄 .

And the v5.0 also had some auto cleaning feature, where it removed the last few messages in the channel. Not sure if that ever was toggleable or just default. E.g. https://github.com/SudhanPlayz/Discord-MusicBot/pull/1023 & https://github.com/SudhanPlayz/Discord-MusicBot/pull/936

brianferri commented 1 year ago

I forgot to enable issues and discussions on the fork. They have now been enabled to allow everyone to suggest bug fixes and features there directly

brianferri commented 1 year ago

moved to https://github.com/wtfnotavailable/Discord-MusicBot/projects/1

C-EO commented 1 year ago

@C-EO

@BioCla One of the reasons I liked v5 is because it had buttons. It would be pointless to create a v5.1 without buttons The player needs the buttons for they simplified the work in addition to the pause, play, stop, and volume commands

I'll take that as a suggestion. I was already planning on reimplementing them under a different dress: Instead of having it be on the player message itself it would be in a dedicated channel (kinda like hydra).

I'll try to reimplement it as you suggested as well

@BioCla When can I expect to see the buttons feature again? Was it implemented or is it still WIP. Please provide feedback

brianferri commented 1 year ago

@C-EO

@BioCla One of the reasons I liked v5 is because it had buttons. It would be pointless to create a v5.1 without buttons The player needs the buttons for they simplified the work in addition to the pause, play, stop, and volume commands

I'll take that as a suggestion. I was already planning on reimplementing them under a different dress: Instead of having it be on the player message itself it would be in a dedicated channel (kinda like hydra).

I'll try to reimplement it as you suggested as well

@BioCla When can I expect to see the buttons feature again? Was it implemented or is it still WIP. Please provide feedback

Make a new issue for it on https://github.com/wtfnotavailable/Discord-MusicBot

We'll keep track of it on the project board

Koekieezz commented 1 year ago

make it compatible with lavalink v4 :)

brianferri commented 1 year ago

make it compatible with lavalink v4 :)

This would certainly be a big and sought after improvement, however we cannot make the bot itself compatible with LLv4 as it depends on the wrappers which are used (It currently supports old erela.js and cosmicord.js). We were hoping in implementing shoukaku as well but it seems the structure is far too different from the rest of the wrappers and needs some research before being optimally integrated.

The bot itself supports multiple wrappers and is easily configurable to integrate even more than the already present ones but implementing a new wrapper right now is not a priority.

If you would like to see your suggestion implemented then make a discussion/issue for it in the official v5.1 repo in https://github.com/wtfnotavailable/Discord-MusicBot

zoli456 commented 1 year ago

Did you try this erela.js fork? https://github.com/Tomato6966/erela.js It need minimal work to replace the old erela.js

brianferri commented 1 year ago

Did you try this erela.js fork? https://github.com/Tomato6966/erela.js It need minimal work to replace the old erela.js

I have looked into it and it would be awesome to have it integrated into the bot. as explained in: https://github.com/SudhanPlayz/Discord-MusicBot/pull/1227#issuecomment-1670911318 The bot supports multiple wrappers and adding another one would just enhance it's POC on modularity. Please make an issue/PR for this suggestion on the main repo: https://github.com/wtfnotavailable/Discord-MusicBot

brianferri commented 1 year ago

marking as draft for long term development moving on wtfnotavailable

brianferri commented 11 months ago

New version available at: https://github.com/wtfnotavailable/Discord-MusicBot