From c73dffb3271258d986ba67fa3e12302b9947b65c Mon Sep 17 00:00:00 2001 From: choelzl Date: Mon, 7 Feb 2022 03:55:22 +0100 Subject: [PATCH] WIP --- twitch/customOverlay.js | 9 ++++++++- web/overlay/index.js | 9 +++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/twitch/customOverlay.js b/twitch/customOverlay.js index 84fbd82..047a022 100644 --- a/twitch/customOverlay.js +++ b/twitch/customOverlay.js @@ -34,8 +34,15 @@ } }); + $.bind('twitchFollow', function(event) { + sendData('follow', event.getFollower()); + }); + $.bind('twitchSubscriber', function(event) { + sendData('subscribe', event.getSubscriber()); + }); + $.bind('initReady', function() { - $.registerChatCommand('./custom/custom/customOverlay.js', 'overlay'); + $.registerChatCommand('./custom/custom/customOverlay.js', 'overlay', 2); $.registerChatSubcommand('overlay', 'follow', 2); $.registerChatSubcommand('overlay', 'subscribe', 2); diff --git a/web/overlay/index.js b/web/overlay/index.js index f997789..f5790bf 100644 --- a/web/overlay/index.js +++ b/web/overlay/index.js @@ -39,8 +39,8 @@ $(function () { $('#follow').text(lastFollow); $('#subscribe').text(lastSub); $('#donate').text(lastDonator); - $('#cfollow').parent().closest('div').progressbar({ value : 5.0/parseInt(queryMap.getOrElse('follow',9999))*100 }); - $('#csubscribe').parent().closest('div').progressbar({ value : 5.0/parseInt(queryMap.getOrElse('subscribe',9999))*100}); + $('#cfollow').parent().closest('div').progressbar({ value : countFollow/parseInt(queryMap.getOrElse('follow',9999))*100 }); + $('#csubscribe').parent().closest('div').progressbar({ value : countSub/parseInt(queryMap.getOrElse('subscribe',9999))*100}); $('#cfollow').text(`${countFollow} / ${queryMap.getOrElse('follow',9999)}`); $('#csubscribe').text(`${countSub} / ${queryMap.getOrElse('subscribe',9999)}`); } @@ -94,8 +94,9 @@ $(function () { refreshUI(); }) socket.getDBValue('get_current_stream_info_counts', 'panelData', 'stream', (e)=>{ - console.log(e) - console.log(JSON.parse(e.panelData)) + let data = JSON.parse(e.panelData); + countFollow = data.followers; + countSub = 0; }) } }catch(e) {console.log(e)}