From aa01e6579a3141fc251d446d8eec8f1eec02c249 Mon Sep 17 00:00:00 2001 From: steveseguin Date: Sun, 14 Jan 2024 21:01:08 -0500 Subject: [PATCH] custom auto responded added --- background.js | 31 +++++++++++++++++++++++++++++++ manifest.json | 2 +- popup.html | 22 +++++++++++++++++++--- popup.js | 24 +++++++++++++++++++++++- 4 files changed, 74 insertions(+), 5 deletions(-) diff --git a/background.js b/background.js index 32256b31..18154438 100644 --- a/background.js +++ b/background.js @@ -3331,6 +3331,25 @@ async function applyBotActions(data, tab=false){ // this can be customized to cr return null; } } + if (data.chatmessage){ + for (var i = 1;i<=10;i++){ + if (settings['botReplyMessageEvent'+i] && settings['botReplyMessageCommand'+i] && settings['botReplyMessageCommand'+i].textsetting && settings['botReplyMessageValue'+i] && settings['botReplyMessageValue'+i].textsetting && (data.chatmessage.indexOf(settings['botReplyMessageCommand'+i].textsetting)!=-1)){ + var timeoutBot = 0; + if (settings['botReplyMessageTimeout'+i]){ + timeoutBot = settings['botReplyMessageTimeout'+i].numbersetting || 0; + } + if (Date.now() - messageTimeout > timeoutBot){ // respond to "1" with a "1" automatically; at most 1 time per minute. + messageTimeout = Date.now(); + var msg = {}; + msg.tid = data.tid; + msg.response = settings['botReplyMessageValue'+i].textsetting; + processResponse(msg); + } + break; + } + } + } + if (settings.blacklist && data.chatmessage){ @@ -3359,6 +3378,18 @@ async function applyBotActions(data, tab=false){ // this can be customized to cr } } + if (settings.autohi && data.chatname){ + if (data.chatmessage.toLowerCase() === "hi"){ + if (Date.now() - messageTimeout > 60000){ // respond to "1" with a "1" automatically; at most 1 time per minute. + messageTimeout = Date.now(); + var msg = {}; + msg.tid = data.tid; + msg.response = "Hi, @"+data.chatname+" !"; + processResponse(msg); + } + } + } + // applyBotActions nor applyCustomActions ; I'm going to allow for copy/paste here I think instead. if (settings.relaydonos && data.hasDonation && data.chatname && data.type){ diff --git a/manifest.json b/manifest.json index 5044ce83..fa3b94d2 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Social Stream Ninja", "description": "Powerful tooling to engage live chat on Youtube, Twitch, Zoom, and more", "manifest_version": 2, - "version": "1.68.2", + "version": "1.68.3", "homepage_url": "http://socialstream.ninja/", "icons": { "128": "icons/icon-128.png" diff --git a/popup.html b/popup.html index 45e72564..d1c69741 100644 --- a/popup.html +++ b/popup.html @@ -208,6 +208,13 @@ border-radius:10px; margin-top:10px; } + #botReplyMessages { + overflow-y: auto; + max-height:156px; + box-shadow: inset 0px 0px 5px #0000002e; + border-radius:10px; + margin-top:10px; + } .rounded_area { background-color: var(--color-accent-subtle); border-radius: 6px; @@ -2467,16 +2474,25 @@

Giphy support


-

Trigger webhook URL by a !command

+

Trigger webhook URL by a !command

+ Have custom chat commands poke a custom API endpoint

-

Send fixed messages at intervals

- + +

Send fixed messages at intervals

+ Specify frequency and starting offset of fixed messages
+
+ +

Auto-responder

+ + Auto-respond to custom chat commands +
+
diff --git a/popup.js b/popup.js index e2e268a9..cd2b272c 100644 --- a/popup.js +++ b/popup.js @@ -334,7 +334,29 @@ document.addEventListener("DOMContentLoaded", async function(event) { document.getElementById("timedMessages").appendChild(chat); } - + for (var i=1;i<=10;i++){ + var chat = document.createElement("div"); + chat.innerHTML = '\ +
\ +
\ + \ + \ +
\ +
\ + \ + \ +
\ +
\ + \ + \ +
\ +
'; + document.getElementById("botReplyMessages").appendChild(chat); + } + var iii = document.querySelectorAll("input[type='checkbox']"); for (var i=0;i