Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Music Player - Button Controls & Volume Command #705

Merged
merged 23 commits into from
May 11, 2022

Conversation

Bacon-Fixation
Copy link
Collaborator

@Bacon-Fixation Bacon-Fixation commented Apr 29, 2022

  • Add Volume control
  • Create Guild Table in DB (requires re-run of npx prisma migrate dev)
  • add Album art Thumbnail
  • Add Queue Length
  • Add Users Info into Track Info to show who requested the track with avatar
  • 30-second inactivity timer
  • Delete Embed at end of song
  • Next & Previous track info
  • add button controls
  • Test

Buttons are only usable by members in the same voice channel as the bot
Player embeds are self deleting when song is done or 30 mins has elapsed
you can bring back the buttons with /now-playing

Edit: TIL it can also play Twitch(livestream only), and SoundCloud audio sources ...... Nice!

Current State - YouTube

image

Tested on
Windows 10 (Local)
Raspberry OS 64Bit (arm64/Local)
Debian 10 (Arm64/Local)

Much Love
-Bacon

@Bacon-Fixation Bacon-Fixation marked this pull request as draft April 29, 2022 21:58
@Bacon-Fixation Bacon-Fixation mentioned this pull request Apr 30, 2022
16 tasks
@Bacon-Fixation Bacon-Fixation marked this pull request as ready for review May 4, 2022 23:55
@Bacon-Fixation
Copy link
Collaborator Author

Bacon-Fixation commented May 4, 2022

dang it forgot now playing

@Bacon-Fixation Bacon-Fixation changed the title Adds Guild Table - Volume Command - Visual Update Music Player - Button Controls & Volume Command May 5, 2022
@Bacon-Fixation
Copy link
Collaborator Author

This should be ready for Review

Would like to merge this before #698, As I will need to resolve some self created merge conflicts between these Pr's <3

Note: I am aware that the Players Embed Color may be green after updating from previous version. This is only temporary, it will sort its self out after a few minutes

Much Love
-Bacon

Removed unused  MessageButton From NowPlayingEmbed

Also Delete Embeds on button press If player is not running
@Bacon-Fixation
Copy link
Collaborator Author

Bacon-Fixation commented May 5, 2022

@galnir, I have a question, shouldn't the migrations folder be added to the .gitignore as running the npx prisma migrate dev compares the folder names to what is inside the DB.
if a "migration" were to be added to the repo, and a user were to run npx prisma migrate dev after a schema change it can cause a DB mismatch and force the user to wipe the current db to continue

i ran into this when setting up my Raspi Pi's for testing and setup instructions and noticed i had to wipe an existing DB twice

Much Love
-Bacon

bugfix - resuming from button no longer causes a crash when paused for longer than the songs remaining time

pausing from buttons for longer than 30 mins the bot will leave channel
@galnir
Copy link
Owner

galnir commented May 9, 2022

@galnir, I have a question, shouldn't the migrations folder be added to the .gitignore as running the npx prisma migrate dev compares the folder names to what is inside the DB. if a "migration" were to be added to the repo, and a user were to run npx prisma migrate dev after a schema change it can cause a DB mismatch and force the user to wipe the current db to continue

i ran into this when setting up my Raspi Pi's for testing and setup instructions and noticed i had to wipe an existing DB twice

Much Love -Bacon

I've read it shouldn't be ignored by Git but in this case it should, so yeah

Copy link
Owner

@galnir galnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many changes so it'll take me some time to review everything, but a couple comments:

  1. Is it possible to extract the button logic from now playing command and ExtendedClient to a function under utils/ ?
  2. Line 192 in now-playing.ts is an unreachable return statement

@Bacon-Fixation
Copy link
Collaborator Author

Bacon-Fixation commented May 9, 2022

  1. sounds like a good idea, I can look into that.

  2. I missed that. My bad, I can correct it

Side question have you run into something I'm calling phantom command data. Like if I make a change to a command and restart the bot to load the changes, I will get back the previous version in discord, but console log shows the current version data. I have now run into this a few times now and it makes it difficult to debug when the changes are not represented correctly.
I even went as far as to clear the command list and re-register all the commands (can only do this 3 times in a day cuz of limits) and would still get a Cached version when running the command. Do you have any suggestions on why or to prevent this?

Issues range from bogus "interaction already been replied to" (I removed them all and still got this message), to the Embed data being random( like shortly after updating my pi to this pr the embed colors were green for 2 hours) there isn't any green in this pr. It has me stretching my head

Much Love
-Bacon

@Bacon-Fixation
Copy link
Collaborator Author

Bacon-Fixation commented May 10, 2022

  • Player Embed Buttons are a function

currently having to run prototype commands on new Discord Client_id's to make sure no Cached Data
my dev bot (windows), with this pr the embed is still green/blue, i don't know how to fix this on my end, console tells me its #ff0000, but it's green/blue, but these PR commands were reloaded dozens of times and its stuck with bogus errors and embed Data

my main(Pi 4 Raspian), it's correct (took few hours to fix its self only had 2 changes to the commands)
the newly created Client_Id's also worked as expected right away (windows)

Much Love
-Bacon

allows for the topic to match the the song title
becomes a speaker auto-magically
@Bacon-Fixation
Copy link
Collaborator Author

Bacon-Fixation commented May 11, 2022

Apologies for the last second addition
but noticed stage channels were not accounted for and wellllllllllll i had some fun <3

it automates becoming a speaker and creating an instance if one is not available
will only edit the topic if the bot creates the instance or the topic already starts with 🎶.

  • Stage Channel Support
    image

corrected the permissions needed for Stage Channel create as per Discordjs Docs
prevent the Topic from exceeding 120 characters
@galnir
Copy link
Owner

galnir commented May 11, 2022

  1. sounds like a good idea, I can look into that.
  2. I missed that. My bad, I can correct it

Side question have you run into something I'm calling phantom command data. Like if I make a change to a command and restart the bot to load the changes, I will get back the previous version in discord, but console log shows the current version data. I have now run into this a few times now and it makes it difficult to debug when the changes are not represented correctly. I even went as far as to clear the command list and re-register all the commands (can only do this 3 times in a day cuz of limits) and would still get a Cached version when running the command. Do you have any suggestions on why or to prevent this?

Issues range from bogus "interaction already been replied to" (I removed them all and still got this message), to the Embed data being random( like shortly after updating my pi to this pr the embed colors were green for 2 hours) there isn't any green in this pr. It has me stretching my head

Much Love -Bacon

I'm quite sure adding the guild id in the command registry options solves it:

  public override registerApplicationCommands(
    registery: ApplicationCommandRegistry
  ): void {
    registery.registerChatInputCommand({
      name: this.name,
      description: this.description,
      options: [
        {
          name: 'playlist-name',
          description: 'What is the name of the playlist you want to create?',
          type: 'STRING',
          required: true
        }
      ]
    }, {guildIds: ['the id of the guild you are testing in']});
  }
}

Copy link
Owner

@galnir galnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work, tested it and it works well 💯
It would be even better if you could find a way to disable or remove the buttons if a user uses /leave instead of hitting a button, but no pressure on that, maybe I will do it myself

@galnir galnir merged commit f376f6f into galnir:main May 11, 2022
@Bacon-Fixation
Copy link
Collaborator Author

currently it should delete an open Player Embed when a button is pressed after the music player has been disconnected, i had to or i would get a console error

i can look into actively deleting the message when /leave, /Skip, /Skipto commands are used

Much Love
-Bacon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants