-
-
Notifications
You must be signed in to change notification settings - Fork 12
Feature/scare queue #46
base: main
Are you sure you want to change the base?
Conversation
handlingCommand = false | ||
|
||
var waitToRunCommand = function() { | ||
setTimeout(runCommand, 300) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
We have merge conflicts here because of the docker deployment. Please use |
1 similar comment
We have merge conflicts here because of the docker deployment. Please use |
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.