diff --git a/README.md b/README.md index f9ce2a3..0bfc003 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,10 @@ This nodecg bundle listens for LBC tips from odysee hyperchat's and renders an alert using the simple-alerts bundle. -I will create a portable version containing node.js, nodecg and the 2 bundles for an easy setup some time this week. +In future releases, this bundle may make use of other bundles such as: +* donation ticker +* chat overlay +* tip history +* top tipper + +In releases, you can find a portable version containing nodecg and simple-alerts for Windows and Linux that is ready to go, just extract it and run it. diff --git a/dashboard/panel.html b/dashboard/panel.html index e25ab8a..529e079 100644 --- a/dashboard/panel.html +++ b/dashboard/panel.html @@ -63,7 +63,7 @@ testInput.setAttribute('id', 'testInput'); var testBtn = document.createElement('button'); - testBtn.setAttribute('type', 'submit'); + //testBtn.setAttribute('type', 'submit'); testBtn.setAttribute('id', 'testBtn'); var testBtnLabel = document.createTextNode("TEST"); testBtn.appendChild(testBtnLabel); @@ -83,10 +83,12 @@ form.appendChild(document.createElement("br")); div.appendChild(form); - NodeCG.waitForReplicants(triggers, claim_id, defaultTrigger, test).then(() => { + NodeCG.waitForReplicants(triggers, claim_id, defaultTrigger).then(() => { document.getElementById('defaultInput').value = defaultTrigger.value; document.getElementById('claimidInput').value = claim_id.value; - triggers.value.forEach(showPanels); + if (triggers.value) { + triggers.value.forEach(showPanels); + } }); function showPanels(value, index, array) { diff --git a/extension/index.js b/extension/index.js index 55fec61..bffbc3f 100644 --- a/extension/index.js +++ b/extension/index.js @@ -27,6 +27,18 @@ module.exports = function (nodecg) { }); } + function addToTicker(username, amount) { + var myJSONObject = {"name": username, "amount": amount}; + request({ + url: 'http://localhost:9090/simple-donation-ticker/ticker', + method: "POST", + json: true, + body: myJSONObject + }, function (error, response, body){ + console.log("Done"); + }); + } + function checkTriggers(amount, alertName) { equals.forEach(isEquals); // Check if alert is equal too a trigger @@ -37,8 +49,8 @@ module.exports = function (nodecg) { } if ( alertName == defaultTrigger.value ) { // Check greater than starting from largest number. - var sorted = triggers.value; - sorted.sort(function(a, b){return b.amount - a.amount}); + var sorted = [...triggers.value]; + sorted.sort( function (a, b) { return b.amount - a.amount } ); for (const value of sorted) { if ( value.type != "equals" && parseFloat(amount) >= parseFloat(value.amount) ) { alertName = value.name; @@ -83,6 +95,7 @@ module.exports = function (nodecg) { var alertName = defaultTrigger.value; var amount = comment.data.comment.support_amount + addToTicker(userName, amount); alertName = checkTriggers(amount, alertName); activateAlert(alertName, userName, amount); }