Skip to content
Queue script for Nightbot
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Decode message separately since it was encode twice Mar 3, 2019
backup VIP userlevel is twitch_vip Jan 13, 2019
bootstrap
database Fix table relations in migration Feb 1, 2019
public
resources/views
routes displayName > name for Youtube Jan 6, 2019
storage Initial commit Apr 20, 2018
tests
.env.example Initial commit Apr 20, 2018
.gitattributes Initial commit Apr 20, 2018
.gitignore Initial commit Apr 20, 2018
README.md
artisan
composer.json
composer.lock
phpunit.xml Initial commit Apr 20, 2018

README.md

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 !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 !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

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
  • 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

Installation

Sign in with Nightbot here, the installer will add the selected commands to Nightbot: https://2g.be/twitch/nbqueue/public/install/auto

Improvements?

  • 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?

Development

  1. Get the repository: git clone https://github.com/xgerhard/nbqueue
  2. From the nbqueue folder run composer install
  3. Rename .env.example to .env and set your database details
  4. Run php artisan migrate to install the required tables
  5. Normally the app only accepts requests made by Nightbot. If your APP_DEBUG value is set to true in your .env file the app will manually add the Nightbot headers, you can set the virtual user and channel here
  6. 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:

  • http://localhost:8080/public/?q=join%20test%20message will run !q join test message
  • http://localhost:8080/public/?q=next%202 will run !q next 2
  • http://localhost:8080/public/?q=list will run !q list
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.