A basic queue system for Nightbot. The usage is pretty straight forward,
!leave for users to enter or leave the queue, the user can check their position in the queue with
!position. Moderators can
!close the queue and pick a user from the queue with
The command supports multiple queues, but there can only be one active. Only the active channel is joinable. Moderators can manage queues by using
!add $queueName or
!del $queueName, to switch to a different queue use
!set $queueName. To empty the queue a moderator can use
!clear, or remove one user by using
!remove $id, where $id is the ID of the user in that specific queue (this ID can be found by using
- join $message - Joines the current queue with optional message "$message", this message is displayed when the user will be picked from the queue
- leave - Leaves the current queue
- position - Displays the position from the user in the current active queue
- list - Displays a link to a webpage with the full list of users in the queue
- info - Displays the current queue information, if the queue is open and how many people are in it
- open - Opens the current queue
- close - Closes the current queue
- next $x - Picks and removes the first $x users from the queue, the $x is optional
- clear - Clears the current queue
- add $name - Creates a new queue with the name $name
- del $name - Deletes the queue with name $name (the default queue can't be deleted)
- set $name - Will set the queue with name $name as active queue.
- remove $id - Will remove the user with id $id from the queue
Sign in with Nightbot here, the installer will add the selected commands to Nightbot: https://2g.be/twitch/nbqueue/public/install/auto
- In the current system the user can only join the active queue. Since the system supports multiple queues, maybe add a parameter to join another queue (if they are open). However there will need to be a good syntax for it first, since everything after !join is currently saved as message, for example to store their gamertag. Maybe something like
!join "$queue" $message-
!join "fortnite" xgerhard.
- When a user is picked, the user will be removed from the database. If the user is not there, the user will lose the spot. Maybe add an option to skip a user, not sure how to handle this yet database wise.
- The queue system currently identifies users by their Id's provided in the Nightbot headers, this means that the only way to join a queue is by typing the join command, a moderator can't add users, which might be a good thing?
- Nightbot has a minimum of 5 sec cooldown on commands, if a big chat will spam !join - some messages will be ignored, the only way a user knows if he/she joined succesfull is if they get a response from Nightbot with a success message. This might be spammy if alot of users want to enter, however if I dont send the confirmation people wouldn't know if they entered.
- People will be able to join a queue through Discord and Twitch at the same time, maybe add a setting to set a main platform and ignore all others?
- Get the repository:
git clone https://github.com/xgerhard/nbqueue
- From the nbqueue folder run
.envand set your database details
php artisan migrateto install the required tables
- Normally the app only accepts requests made by Nightbot. If your
APP_DEBUGvalue is set to
.envfile the app will manually add the Nightbot headers, you can set the virtual user and channel here
- Start a local webserver:
php -S localhost:8080
Now you'll be able to run chat commands directly through the browser by setting the
q parameter in the url, for example:
!q join test message
!q next 2