Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make merch message timing work #2

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
squash
Decrement timing on every timing update

Decrement timing on every timing update
  • Loading branch information
plusreed committed Oct 12, 2022
commit 4cf8d340a26644df439b120289db4561f5a57373
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ const readline = require('readline')
const addSeconds = require('./util/addSeconds')
const config = require('./config/config.json')

const addSeconds = require('./util/addSeconds')

const app = express()
const server = http.createServer(app)
const io = new Server(server)
@@ -164,7 +162,11 @@ function wsl (...args) {

const MessageHandler = {
_emitTimingUpdate: function (_io) {
// TODO: Go through merch messages and decrement every timing by 1
TABELLARIUS_STATE.merch_messages.forEach((m) => {
if (m.timing > 0) {
m.timing--
}
})
_io.emit('updateTimings', {
backlog: TABELLARIUS_STATE.merch_messages,
queueLength: TABELLARIUS_STATE.merch_messages.length,