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

New event: playerStateUpdate #16

Closed
Vexify4103 opened this issue Jul 25, 2023 · 1 comment
Closed

New event: playerStateUpdate #16

Vexify4103 opened this issue Jul 25, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Vexify4103
Copy link
Contributor

Vexify4103 commented Jul 25, 2023

Event Details:

The "playerStateUpdate" event would be triggered whenever there is a significant state change in the player. Specifically, it should respond with the following information:

  1. Player: The instance of the player that experienced the state change.
  2. State Update: A descriptive object containing details about the specific change that occurred. This could include information about pausing, resuming, and loop-mode changes.

Supported State Changes:

The event should cover the following player state updates:

  • Pause/Resume: When the player gets paused or resumed during music playback.
  • Loop Mode: When the loop-mode of the player changes from "track" to "queue" or "off" (and vice versa).

Use Case:

The primary purpose of this event is to help developers handle potential timeout issues in their Discord bots. At times, due to external factors, the bot's timeout duration may be shorter than the duration of the track playing through the player. This can result in the player getting destroyed while it is actively playing music, leading to an inconsistent and unpleasant user experience.

By having access to the "playerStateUpdate" event, developers can implement custom timeout handling strategies. For example, if the bot's timeout is about to expire, they can check if the player is actively playing and, if so, extend the timeout or take appropriate actions to prevent the player from being destroyed prematurely.

Benefits:

Adding the "playerStateUpdate" event would offer the following benefits:

  1. Improved Bot Reliability: Developers can implement better timeout management to avoid issues with active music playback.
  2. Enhanced Customization: The event allows for more sophisticated state-change handling tailored to specific bot requirements.
  3. Real-time Monitoring: Developers can have insights into player state changes as they occur, enabling them to respond accordingly.
@SxMAbel
Copy link
Collaborator

SxMAbel commented Jul 25, 2023

"State Update: A descriptive object containing details about the specific change that occurred. This could include information about pausing, resuming, and loop-mode changes."

In the Player you can check for what has been changed instead of having duplicates, example: someone pauses the player, the playerStateUpdate will fire, and you can access what type of change you are looking for, in this example, "pause" so you can do player.paused to get either true or false.

Edit: Everything else seems to be interesting and this will be implemented. Thank you for the feature request.

@SxMAbel SxMAbel added the enhancement New feature or request label Jul 25, 2023
@SxMAbel SxMAbel closed this as completed Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants