From 762dde19452fd00b64d722d268b91a8c59327be0 Mon Sep 17 00:00:00 2001 From: Freedbot <51814351+Freedbot@users.noreply.github.com> Date: Wed, 16 Jul 2025 09:38:07 -0500 Subject: [PATCH 1/4] Create widget.md Adding Chat Ding widget description. --- ChatDing/widget.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 ChatDing/widget.md diff --git a/ChatDing/widget.md b/ChatDing/widget.md new file mode 100644 index 0000000..9e1a64c --- /dev/null +++ b/ChatDing/widget.md @@ -0,0 +1,10 @@ +# Chat Ding +This widget plays a sound when a chat message is recieved in Twitch or Youtube chat (youtube untested). Useful for streamers with few viewers that forget to check chat regularly. There is no HTML or CSS. This is audio only. Feel free to edit the first JS variable to add more events to ding for. The code is sound, but the functionality and integration could easily be improved upon. I scraped this together and modified it from reddit. + +Config options: +* Audio File URL (must end in .mp3). There is a default entry from freesound.org +* Ding Volume +* Cooldown in seconds before new dings can be triggered + +## IMPORTANT: +Do NOT use this in the "normal" StreamElements source way. Your chat does not want to hear a ding on stream for every message. When you add this to OBS as a browser source, check "Control Audio with OBS". This will add an extra audio channel. Configure this channel to "Monitor Only". Of course, you also can't stream the all "Desktop Audio" channel using this method. From 7bb9dfdc06b76a07abd17e562efe2bc84c94a073 Mon Sep 17 00:00:00 2001 From: Freedbot <51814351+Freedbot@users.noreply.github.com> Date: Wed, 16 Jul 2025 09:51:53 -0500 Subject: [PATCH 2/4] Create widget.js Chat Ding javascript --- ChatDing/widget.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ChatDing/widget.js diff --git a/ChatDing/widget.js b/ChatDing/widget.js new file mode 100644 index 0000000..1355476 --- /dev/null +++ b/ChatDing/widget.js @@ -0,0 +1,29 @@ +// twitch and youtube message events +var eventList = ["message", "youtube#liveChatMessage"]; +var cooling = null; + +var audio, coolDown; +// on widget load, apply settings variables and load sound file +window.addEventListener('onWidgetLoad', (obj) => { + const {fieldData} = obj.detail; + audio = new Audio(fieldData.dingSound); + audio.volume = fieldData.dingVolume / 100; + audio.autoplay = false; + coolDown = fieldData.coolDown; +}) +// on message recieved, stop any existing ding, play ding, and apply cooldown +// message events are ignored entirely while on cooldown +window.addEventListener('onEventReceived', (obj) => { + if (cooling === null) { + if (eventList.includes(obj.detail.listener)) + { + if (!audio.paused) + { + audio.pause(); + audio.currentTime = 0; + } + audio.play(); + cooling = setTimeout(() => {cooling = null;}, coolDown * 1000) + } + } +}); From fe9c0de2fef5534b95c27d3da1849f2567e46c32 Mon Sep 17 00:00:00 2001 From: Freedbot <51814351+Freedbot@users.noreply.github.com> Date: Wed, 16 Jul 2025 09:53:22 -0500 Subject: [PATCH 3/4] Create widget.json Chat Ding settings fields --- ChatDing/widget.json | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 ChatDing/widget.json diff --git a/ChatDing/widget.json b/ChatDing/widget.json new file mode 100644 index 0000000..2d0a3a9 --- /dev/null +++ b/ChatDing/widget.json @@ -0,0 +1,31 @@ +{ + "widgetName": { + "type": "hidden", + "value": "Chat Message Dings" + }, + "widgetAuthor": { + "type": "hidden", + "value": "Freedbot" + }, + "dingSound": { + "type": "text", + "label": "Audio File URL (must end in .mp3)", + "value": "https://freesound.org/data/previews/235/235911_2391840-lq.mp3" + }, + "dingVolume": { + "type": "slider", + "label": "Ding Volume", + "value": 70, + "min": 0, + "max": 100, + "step": 1 + }, + "coolDown": { + "type": "number", + "label": "Cooldown in seconds before new dings can be triggered", + "value": 5, + "min": 1, + "max": 10000, + "step": 1 + } +} From 237abca4bdba6dfc7369c0085a4206989ecfe0f1 Mon Sep 17 00:00:00 2001 From: Freedbot <51814351+Freedbot@users.noreply.github.com> Date: Wed, 16 Jul 2025 09:56:30 -0500 Subject: [PATCH 4/4] Rename widget.md to README.md --- ChatDing/{widget.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ChatDing/{widget.md => README.md} (100%) diff --git a/ChatDing/widget.md b/ChatDing/README.md similarity index 100% rename from ChatDing/widget.md rename to ChatDing/README.md