Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions commands/queueManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { state } from '../constants.js';

async function handleOpenCommand(channel, tags, client, io) {
state.queue_open = true;
await settings_db.set('queue_open', true);
abbadabbabotSay(channel, client, tags, 'formally announce the opening of the queue to the chat');
io.emit('new_turn', `Queue Just Opened`);
}

async function handleCloseCommand(channel, tags, client, io) {
state.queue_open = false;
await settings_db.set('queue_open', false);
abbadabbabotSay(channel, client, tags, 'formally announce the closing of the queue to the chat');
io.emit('new_turn', `Queue Closed`);
}
Expand Down
9 changes: 7 additions & 2 deletions constants.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import dotenv from 'dotenv';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { dirname, join } from 'path';
import jsoning from 'jsoning';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const settings_db = new jsoning(join(__dirname, 'db/queue_settings.json'));

const persistedQueueOpen = settings_db.get('queue_open');

dotenv.config();

export const state = {
current_turn: "None... yet",
end_time: 1708317900,
queue_open: false,
queue_open: persistedQueueOpen ?? false,
firsts_first: true,
ai_enabled: true,
death_count: 0,
Expand Down
13 changes: 12 additions & 1 deletion db/queue_settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
{"last_turn_type":false,"deeze_nutz":2650,"turn_count":2501,"youtubes_watched":74,"notification":"<h3><span style=\"font-family: helvetica, arial, sans-serif; background-color: #f1c40f; font-size: 24pt;\">Sexy Mustard Sandwich: 5 | Skooty: 2 | Josh: 5</span><br /><span style=\"font-family: helvetica, arial, sans-serif;\"><span style=\"background-color: #f1c40f;\"><span style=\"text-decoration: line-through;\">Propose and get a yes&nbsp;</span><br /></span><span style=\"background-color: #f1c40f;\">Ask someone to suck cheeto dust off fingers</span></span><br /><span style=\"text-decoration: line-through;\"><span style=\"font-family: helvetica, arial, sans-serif; background-color: #f1c40f;\">Nickelodeon cartoon avatar</span></span><br /><span style=\"font-family: helvetica, arial, sans-serif;\"><span style=\"background-color: #f1c40f;\">Giant Nose with boogers<br /></span><span style=\"background-color: #f1c40f;\">Sing with someone</span></span></h3>","subsTracker":1057,"bitsTracker":80612,"donationsTracker":2119.5205564735597,"completedSpins":3}
{
"last_turn_type": false,
"deeze_nutz": 2650,
"turn_count": 2501,
"youtubes_watched": 74,
"notification": "<h3><span style=\"font-family: helvetica, arial, sans-serif; background-color: #f1c40f; font-size: 24pt;\">Sexy Mustard Sandwich: 5 | Skooty: 2 | Josh: 5</span><br /><span style=\"font-family: helvetica, arial, sans-serif;\"><span style=\"background-color: #f1c40f;\"><span style=\"text-decoration: line-through;\">Propose and get a yes&nbsp;</span><br /></span><span style=\"background-color: #f1c40f;\">Ask someone to suck cheeto dust off fingers</span></span><br /><span style=\"text-decoration: line-through;\"><span style=\"font-family: helvetica, arial, sans-serif; background-color: #f1c40f;\">Nickelodeon cartoon avatar</span></span><br /><span style=\"font-family: helvetica, arial, sans-serif;\"><span style=\"background-color: #f1c40f;\">Giant Nose with boogers<br /></span><span style=\"background-color: #f1c40f;\">Sing with someone</span></span></h3>",
"subsTracker": 1057,
"bitsTracker": 80612,
"donationsTracker": 2119.5205564735597,
"completedSpins": 3,
"queue_open": false
}
8 changes: 6 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const request = require("request");
const express = require("express");
const app = express();
const port = 3000;
const jsoning = require("jsoning");
const settings_db = new jsoning("db/queue_settings.json");

const client = new tmi.Client({
options: { debug: true },
Expand All @@ -14,8 +16,8 @@ const client = new tmi.Client({
});

client.connect();
//Queue closed by default
var queue_open = false;
//Queue closed by default unless stored in db
var queue_open = settings_db.get('queue_open') || false;
var queue = [];
var turn_counter = [];
var firsts_first = false;
Expand Down Expand Up @@ -357,6 +359,7 @@ client.on("message", (channel, tags, message, self) => {
if (isBroadcaster || tags.username == "zilchgnu") {
//set queue_open to true
queue_open = true;
settings_db.set('queue_open', true);
//let the chat know what is up
client.say(channel, `@${tags["display-name"]} has opened the queue!`);
}
Expand All @@ -367,6 +370,7 @@ client.on("message", (channel, tags, message, self) => {
if (isBroadcaster|| tags.username == "zilchgnu") {
//set queue_open to true
queue_open = false;
settings_db.set('queue_open', false);
//let the chat know what is up
client.say(channel, `@${tags["display-name"]} has closed the queue!`);
}
Expand Down