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

feat: Flip flop switch for resume/pause events #912

Closed
wants to merge 8 commits into from
Closed

feat: Flip flop switch for resume/pause events #912

wants to merge 8 commits into from

Conversation

BioCla
Copy link
Contributor

@BioCla BioCla commented Jun 17, 2022

Please describe the changes this PR makes and why it should be merged:
Requested by a fellow member of the discord server, thinking it was a good idea to reduce the clutter which could be made in chats as one might frequently enter and exit a VC, this feat automatically deletes old messages regarding this matter.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

* @param {Message} message
*/
setPausedMessage(message) {
if (this.resumeMessage) this.resumeMessage.delete();
Copy link
Contributor

Choose a reason for hiding this comment

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

Deletion of resume message should happen based on timeout not based on setPausedMessage.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a problem about this method having to delete the old message before setting the new one. Is there any misbehavior which is why we need some delay before deleting the old message?

Saud-97 added a commit to Saud-97/Discord-MusicBot that referenced this pull request Jun 17, 2022
@BioCla BioCla marked this pull request as draft June 17, 2022 22:19
@BioCla
Copy link
Contributor Author

BioCla commented Jun 17, 2022

marking as draft cause buggy ;-; and im tired

Copy link
Contributor

@Saud-97 Saud-97 left a comment

Choose a reason for hiding this comment

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

Comments after I tested this:

* @param {Message} message
*/
setResumeMessage(message) {
if (this.pausedMessage) this.pausedMessage.delete();
Copy link
Contributor

@Saud-97 Saud-97 Jun 17, 2022

Choose a reason for hiding this comment

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

This has 2 issues.

this.pausedMessage

will return true even if the message was already deleted. so probably check using another way.

Secondly, it would be better if the deletion happens before the resume message is sent instead of after. Cuz I tested how it looks and it was looking weird when it has duplicated messages and then the pause get deleted after a second or so. So it would look better if pause is deleted before sending resume embed.

Copy link
Contributor

Choose a reason for hiding this comment

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

will return true even if the message was already deleted. so probably check using another way.
^^

As discord.js starting version 13.4 had deprecated the Structure#deleted getter and removed tracking functionality of all deleted stuff, we will have to track it ourselves if we're gonna insist to reduce invalid API call in case the original message was deleted but it still in cache.

@BioCla
Copy link
Contributor Author

BioCla commented Jun 18, 2022

I am currently working on implementing a new method for keeping track of the deleted messages and hopefully avoiding the deprecated property of Message#deleted.

referring to #7074 on the official DJS repo and making use of the code defined in this response

fundamentally:
image

@BioCla
Copy link
Contributor Author

BioCla commented Jun 18, 2022

Closing this PR and making a new one once everything is taken care of and fully implemented

@BioCla BioCla closed this Jun 18, 2022
@BioCla BioCla deleted the v5 branch June 18, 2022 11:28
DarrenOfficial pushed a commit that referenced this pull request Jun 18, 2022
* feat: Flip flop switch for resume/pause events

Continuation of [#912](#912)

Requested by a fellow member of the discord server, thinking it was a good idea to reduce the clutter which could be made in chats as one might frequently enter and exit a VC, this feat automatically deletes old messages regarding this matter.

* formatting

* Update DiscordMusicBot.js
cobianic pushed a commit to cobianic/Discord-VarenykBot that referenced this pull request Jun 21, 2022
* feat: Flip flop switch for resume/pause events

Continuation of [#912](SudhanPlayz/Discord-MusicBot#912)

Requested by a fellow member of the discord server, thinking it was a good idea to reduce the clutter which could be made in chats as one might frequently enter and exit a VC, this feat automatically deletes old messages regarding this matter.

* formatting

* Update DiscordMusicBot.js
# Conflicts:
#	config.js
#	events/voiceStateUpdate.js
goaldev added a commit to goaldev/Discord-MusicBot that referenced this pull request Oct 2, 2023
* feat: Flip flop switch for resume/pause events

Continuation of [#912](SudhanPlayz/Discord-MusicBot#912)

Requested by a fellow member of the discord server, thinking it was a good idea to reduce the clutter which could be made in chats as one might frequently enter and exit a VC, this feat automatically deletes old messages regarding this matter.

* formatting

* Update DiscordMusicBot.js
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.

3 participants