Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Feature/scare queue #46

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ALMerrill
Copy link
Contributor

@ALMerrill ALMerrill commented Oct 5, 2020

Closes #34

This allows multiple scare commands to be sent while a scare command is currently being processed.

If a scare command is being processed, other commands that come in get put in a queue, and the first event handler keeps running until the queue is empty.

Note: the waitToRunCommand function is there, because the bot was having issues leaving the voice channel and entering again immediately, so I put that in to buffer it each time that happens.

@illusi0nary illusi0nary self-requested a review October 6, 2020 09:28
@LucasCtrl LucasCtrl added this to the Release v1.3.0 milestone Oct 6, 2020
handlingCommand = false

var waitToRunCommand = function() {
setTimeout(runCommand, 300)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there a timeout in the queue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was an error where the bot would leave the voice channel and then reenter it immediately, which would cause the command to stop running and the bot got stuck in the voice channel, so I buffered it with that.

}

var runCommand = function() {
handlingCommand = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this not be handled by Promises / Observables / Callbacks to prevent having to manage a flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It probably could, I'm not super familiar with how to do that. You're welcome to make changes if you'd like. Or you could try to walk me through that

Copy link
Contributor

@tmttn tmttn Oct 8, 2020

Choose a reason for hiding this comment

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

I started a PR to your feature branch in your fork.

@illusi0nary
Copy link
Contributor

We have merge conflicts here because of the docker deployment.

Please use git rebase main or git merge main on your branch in order to make it mergeable :-)

1 similar comment
@illusi0nary
Copy link
Contributor

We have merge conflicts here because of the docker deployment.

Please use git rebase main or git merge main on your branch in order to make it mergeable :-)

@illusi0nary illusi0nary added the hacktoberfest Issue dedicated to the Hacktoberfest label Oct 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extension hacktoberfest Issue dedicated to the Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Extension HBS: Add a queue for the requested scares
4 participants