Intro
I’ve been asked to create a queue system/command for a channel, even though on the forums we have a couple queue systems available, through for example the creative usage of the quote system, I thought this would be a fun little project to play around with various stuff, Nightbot headers, Nightbot API, OAuth.
The code behind the system is available at: GitHub - xgerhard/nbqueue: Queue script for Nightbot
If you have improvements or issues feel free to post them there, or let me know in the comments here.
nbqueue
A basic queue system for Nightbot. The usage is pretty straight forward, !join
and !leave
for users to enter or leave the queue, the user can check their position in the queue with !position
. Moderators can !open
or !close
the queue and pick a user from the queue with !next
.
The command supports multiple queues, but there can only be one active. Only the active channel is joinable. Moderators can manage queues by using !q add $queueName
or !q del $queueName
, to switch to a different queue use !q set $queueName
. To empty the queue a moderator can use !q clear
, or remove one user by using !q remove $position
, where $position is the position of the user in that specific queue (this position can be found by using !q list
).
User commands
- 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
- who $x - Displays the next $x people that are in the queue
Moderator commands
- 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
- random $x - Picks and removes $x random 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 $position - Will remove the user with position $position from the queue
- userlevel $userlevel - Will set the userlevel of current active queue, so you can create for example sub only queues. Available userlevels: moderator, vip, regular, subscriber, everyone.
- ul $userlevel - Short version of the userlevel command
- promote $position - Will promote the user with position $position to first position of the queue (next person)
- setlimit $number - Will set a limit of users that can join the current active queue
- adduser $name - Will add user $username to the current active queue (Twitch only)
Installation
Sign in with Nightbot here, the installer will add the selected commands to Nightbot: https://nbq.gerhard.dev/install/auto
Changelog, December 8, 2018 - userlevel option added
This will give you the option to set your current queue open for a specific group of users.
The userlevel option is available directly from the !q command, for example: !q userlevel subscriber
.
If you want a separate !userlevel command, it is now included in the automatic installation. If you have installed before this date you can add the alias command yourself:
!commands add !userlevel -a=!q userlevel $(query)
Changelog, April 29, 2019 - random, promote commands added
These commands can be used to pick random users from your queue, or reward a user by promoting the user to the first position of the queue. They are available through the !q command, for example: !q random
or !q promote 2
(where 2 is the queue position of the user).
If you want separate commands for these functions, they are now included in the automatic installation. If you have installed before this date, you can add the alias commands yourself:
Random: !commands add !random -a=!q random $(query)
Promote: !commands add !promote -a=!q promote $(query)
Changelog, Feb 21, 2021 - Manual add users
For Twitch channels, moderators can now add users manually to the queue.
Usage is: !q adduser $username
for example !q adduser xgerhard