Giter Club home page Giter Club logo

nbqueue's Introduction

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

nbqueue's People

Contributors

danielhaaser avatar xgerhard avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.