diff --git a/README.md b/README.md index c5c81b71..101eaed2 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ dev goals for 1.1 pineapple express: - videojs.coffee(hls,videojs,raw-file,gdrive,rtmp) ✓ - dailymotion ~(this is kinda broken, likely not possible client-side without breaking CORS policy. This can wait until next version when an installation script including nginx and cors-proxy config gets added to support the catbox.moe image upload button which faces the same issue. - vimeo ✓ + - slide out panel (not an end user feature in and of itself, however a common UI element used for most menus, made to be quick and ezpz ✓ - function for opening, closing ✓ - allow switching menus on panel without having to open/close it ✓ @@ -228,9 +229,11 @@ dev goals for 1.1 pineapple express: - display on tooltip ✓ - add toke to profile client side on toke(avoid sending information twice, write after tokes in tooltip) ✓ - include modflair on tokewhisper ✓ + - reset toke cooldown every hour at *:19:30 for 4:20 !tokes ✓ + - extend toke until *:20:00 if it ends after *:19:30 but before *:20:00 ✓ - autobump - - Serverside + - Serverside ✓ - Bump Management System ✓ - bump object: name, user(person who made bump, optional), lowername, resettoke bool, id, listname, media item ✓ - bumplist object: name, lowername, bump array ✓ @@ -249,7 +252,7 @@ dev goals for 1.1 pineapple express: - remove whitespace and non - or _ specials from lowernames ✓ - bump ✓ - bumplist ✓ - - Automated Bump Queueing + - Automated Bump Queueing ✓ - base queueing function ✓ - queue bump next ✓ - call from socket ✓ @@ -285,26 +288,14 @@ dev goals for 1.1 pineapple express: - minimum length to bump (default: 240 sec) ✓ - base setting ✓ - set from packet ✓ - - per-channel config files in bumps/config/.conf, loaded on channel startup for persistent settings(move to db by next major update) - - json object with following values - - active lists - - write ✓ - - load ✓ - - agro level - - write ✓ - - load ✓ - - bump frequency - - write ✓ - - load ✓ - - bump selmed - - write ✓ - - load ✓ - - list selmed - - write ✓ - - load ✓ - - min length to bump - - write ✓ - - load ✓ + - per-channel config files in bumps/config/.conf, loaded on channel startup for persistent settings(move to db by next major update) ✓ + - json object with following values ✓ + - active lists ✓ + - agro level ✓ + - bump frequency ✓ + - bump selmed ✓ + - list selmed ✓ + - min length to bump ✓ - Add manual only property to bump object(default false). - add boolean to obj ✓ - add to handleAddBump & its type ✓ @@ -314,7 +305,8 @@ dev goals for 1.1 pineapple express: - full random ✓ - last-half random ✓ - Change packList to send history as array of arrays ([[lname,id],[lname,id]]) ✓ - - double check perms(all actions should be at least mod+ only) + - double check perms(all actions should be at least mod+ only) ✓ + - reset tokebot when tokebump is played ✓ - Clientside - finishing touches diff --git a/src/channel/autobump.js b/src/channel/autobump.js index 162ec953..59bb3264 100644 --- a/src/channel/autobump.js +++ b/src/channel/autobump.js @@ -396,7 +396,7 @@ AutobumpModule.prototype.lastHalfRandom = function lastHalfRandom(){ }); alist.forEach(function(bump){ - if(bump != null) + if(bump != null && !bump.noauto) alength++; }); if(inhist.length >= alength){//if all active bumps have been played @@ -465,6 +465,7 @@ AutobumpModule.prototype.queueBump = function(listn, bid){//listname, bump ID var nmed = new Media(bump.media.id, bump.media.title, bump.media.seconds, bump.media.type, bump.media.meta);//revive media object, should probably do this when parsing JSON but fuck you this works :P nmed.isBump = true; + nmed.tokeBump = bump.rtoke; this.channel.modules.playlist._addItem(nmed, data, "autobump"); @@ -703,7 +704,6 @@ AutobumpModule.prototype.handleNewBump = function(user, data){//handle newBump }); return; } - media.isBump = true; if(data.user === ""){ data.user = null; } diff --git a/src/channel/tokebot.js b/src/channel/tokebot.js index 609416c6..b251fa83 100644 --- a/src/channel/tokebot.js +++ b/src/channel/tokebot.js @@ -92,6 +92,14 @@ TokebotModule.prototype.cdel = 120; TokebotModule.prototype.ctime = 120; TokebotModule.prototype.statmap = null; + +TokebotModule.prototype.onMediaChange = function(data){ + if(data.tokeBump){ + this.ctime = 0; + console.log("[Tokebot] Cooldown reset on " + this.channel.name + " triggered by bump."); + } +} + //mod commands TokebotModule.prototype.resettoke = function(user, msg, _meta){ if(user.account.effectiveRank >= 2 && this.toking == 2){ @@ -168,7 +176,20 @@ TokebotModule.prototype.toke = function (user, msg, _meta){ }; TokebotModule.prototype.countdown = function (tb){ + var dateobj = new Date(); tb.toking = 1;//set toking mode + + if(dateobj.getUTCMinutes() == 19){ + var ext = 60 - dateobj.getUTCSeconds(); + + if(ext <= 30){//we let it immediatly reset the cooldwon, but might as well extend it + console.log("[Tokebot] Toke extended on " + tb.channel.name + " by seconds " + ext + " because it's about to be 4:20 somewhere!"); + tb.cdown = 3; + setTimeout(tb.countdown, 1000 * ext, tb); + return; + } + + } tb.tokesay(tb.cdown + "...");//send countdown msg --tb.cdown;//count down @@ -206,8 +227,15 @@ TokebotModule.prototype.endtoke = function (tb){ TokebotModule.prototype.cooldown = function (tb){ if(tb.ctime > 0){ + var dateobj = new Date(); tb.toking = 2; --tb.ctime; + if((dateobj.getUTCMinutes() == 19) && (dateobj.getUTCSeconds() >= 30)){ + console.log("[Tokebot] Cooldown reset on " + tb.channel.name + " triggered because it's about to be 4:20 somewhere!"); + tb.toking = 0; + tb.ctime = tb.cdel; + return; + } setTimeout(tb.cooldown, 1000, tb); }else{ tb.toking = 0; diff --git a/src/media.js b/src/media.js index f8ee5dc5..5da9e21a 100644 --- a/src/media.js +++ b/src/media.js @@ -16,6 +16,7 @@ function Media(id, title, seconds, type, meta) { this.currentTime = 0; this.paused = false; this.isBump = false; + this.tokeBump = false; } Media.prototype = {