A Google Apps Script-based API for managing a queue of users across multiple channels. This script allows Nightbot to interact with a Google Sheet to handle queue actions like joining, leaving, listing, and managing priorities. It is ideal for streamers or a group of streamers who want to manage their viewer queue efficiently.
- Cross-Channel Sync: The queue is shared across multiple channels, preventing users from entering the queue in different channels to get a better position.
- Priority System: The queue prioritizes users based on the following criteria:
- Top Tippers (Tip >= $6, ranked by highest tip amount)
- Subscribers, Moderators, and Owners
- Users with Smaller Tips (ranked by tip amount)
- Regular Followers (sorted by join time)
- Flexible Commands: Easily manage the queue with Nightbot commands, including joining, leaving, checking position, clearing the queue, and more.
- Customizable Responses: Returns JSON responses that can be parsed by Nightbot using `$(eval)`.
- Google Account: You need a Google account to set up the Google Apps Script.
- Google Sheets: Create a Google Sheet with the following columns in the first row:
- `Username`
- `Channel`
- `Timestamp`
- `Priority`
- `Tip Amount`
- Nightbot Access: Ensure you have Nightbot set up on your channel(s) with moderator permissions.
- Open Google Apps Script and create a new project.
- Copy the provided script into the editor.
- Save the project and name it (e.g., `Nightbot Queue API`).
- Click on Deploy > New Deployment.
- Choose Web App as the type.
- Set Who has access to Anyone.
- Click Deploy, and copy the provided URL.
Replace `YOUR_ID` in the commands below with your deployed script's URL (without any query parameters).
| Command | Message | Userlevel | | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------------- | --- | ----------------------- | --------- | | !clearqueue | `!clearqueue
This is an example sheet:
| Username | Channel | Timestamp | Priority | Tip Amount |
|---|---|---|---|---|
| senne1009 | senne1009 | 09/11/2024 22:32 | TRUE | 0 |
| asdasdsa | asdasasd | 09/11/2024 22:32 | FALSE | 20 |
| xzczczxc | xzczczxc | 09/11/2024 22:32 | FALSE | 10 |
| hgfhgfhg | ghghgghg | 09/11/2024 22:32 | FALSE | 2 |
| iouoiuio | uiouoiuio | 09/11/2024 22:32 | FALSE | 0 |
- Unexpected Token Error: Ensure that your Google Apps Script is deployed with access set to Anyone.
- Permissions Error: Make sure Nightbot has moderator permissions in your channel.
- Queue Not Sorting Properly: Ensure the correct data types are used in the Google Sheet (e.g., `TRUE` for subscribers, numeric values for tips).
-
Better Code Organization
Split the code into smaller, reusable parts to make it easier to update and maintain.
-
Improved Error Handling
Provide clearer error messages and feedback when something goes wrong. Use logging to help track and fix issues faster.
-
Faster Performance
Reduce the number of times the script interacts with Google Sheets to speed things up. Cache data locally during execution for quicker access.
-
Concurrency Control
Prevent multiple users from making conflicting changes to the queue at the same time using locks.
-
Flexible Sorting Options
Allow users to customize the queue sorting (e.g., prioritize top tippers or subscribers).
-
Enhanced Data Validation
Add checks to ensure the data added to the queue is accurate and consistent.
Feel free to fork this project and submit pull requests. Any contributions are welcome to improve the queue management system!
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or issues, please reach out via GitHub or open an issue in this repository.