From 3860c49b65ce3b3c558ff8034a9bffdec817d19d Mon Sep 17 00:00:00 2001 From: nuttylmao Date: Mon, 25 Aug 2025 21:01:23 +1000 Subject: [PATCH] Added support for Twitch + TikTok follows --- horizontal-chat/script.js | 37 ++++++++++++++++++++++++-- horizontal-chat/settings/settings.json | 17 ++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/horizontal-chat/script.js b/horizontal-chat/script.js index 9c0677b..ba14644 100644 --- a/horizontal-chat/script.js +++ b/horizontal-chat/script.js @@ -46,6 +46,7 @@ const groupConsecutiveMessages = GetBooleanParam("groupConsecutiveMessages", tru const showTwitchMessages = GetBooleanParam("showTwitchMessages", true); const showTwitchAnnouncements = GetBooleanParam("showTwitchAnnouncements", true); +const showTwitchFollows = GetBooleanParam("showTwitchFollows", false); const showTwitchSubs = GetBooleanParam("showTwitchSubs", true); const showTwitchChannelPointRedemptions = GetBooleanParam("showTwitchChannelPointRedemptions", true); const showTwitchRaids = GetBooleanParam("showTwitchRaids", true); @@ -64,6 +65,7 @@ const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", tru const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true); const enableTikTokSupport = GetBooleanParam("enableTikTokSupport", false); +const showTikTokFollows = GetBooleanParam("showTikTokFollows", false); const showTikTokMessages = GetBooleanParam("showTikTokMessages", false); const showTikTokGifts = GetBooleanParam("showTikTokGifts", false); const showTikTokSubs = GetBooleanParam("showTikTokSubs", false); @@ -134,6 +136,11 @@ client.on('Twitch.Announcement', (response) => { TwitchAnnouncement(response.data); }) +client.on('Twitch.Follow', (response) => { + console.debug(response.data); + TwitchFollow(response.data); +}) + client.on('Twitch.Sub', (response) => { console.debug(response.data); TwitchSub(response.data); @@ -410,6 +417,9 @@ function TikfinityConnect() { case 'chat': TikTokChat(data); break; + case 'follow': + TikTokFollow(data); + break; case 'gift': TikTokGift(data); break; @@ -626,6 +636,20 @@ async function TwitchAnnouncement(data) { ShowAlert(message, background); } +function TwitchFollow(data) { + if (!showTwitchFollows) + return; + + // Set the text + let username = data.user_name; + if (data.user_name.toLowerCase() != data.user_login.toLowerCase()) + username = `${data.user_name} (${data.user_login})`; + + const message = `${username} followed`; + + ShowAlert(message, 'twitch'); +} + async function TwitchSub(data) { if (!showTwitchSubs) return; @@ -1499,7 +1523,16 @@ async function TikTokChat(data) { AddMessageItem(instance, data.msgId, 'tiktok', data.userId); } -async function TikTokGift(data) { +function TikTokFollow(data) { + if (!showTikTokFollows) + return; + + const message = `${data.nickname} followed`; + + ShowAlert(message, 'tiktok'); +} + +function TikTokGift(data) { if (!showTikTokGifts) return; @@ -1519,7 +1552,7 @@ async function TikTokGift(data) { ShowAlert(message, 'tiktok'); } -async function TikTokSubscribe(data) { +function TikTokSubscribe(data) { if (!showTikTokSubs) return; diff --git a/horizontal-chat/settings/settings.json b/horizontal-chat/settings/settings.json index 52dbd2c..2891d09 100644 --- a/horizontal-chat/settings/settings.json +++ b/horizontal-chat/settings/settings.json @@ -143,6 +143,14 @@ "defaultValue": true, "group": "Which Twitch messages do you want to see?" }, + { + "id": "showTwitchFollows", + "label": "New Followers", + "description": "", + "type": "checkbox", + "defaultValue": false, + "group": "Which Twitch messages do you want to see?" + }, { "id": "showTwitchSubs", "label": "New Subscribers", @@ -264,6 +272,15 @@ "showIf": "enableTikTokSupport", "group": "Which TikTok messages do you want to see?" }, + { + "id": "showTikTokFollows", + "label": "New Followers", + "description": "", + "type": "checkbox", + "defaultValue": true, + "showIf": "enableTikTokSupport", + "group": "Which TikTok messages do you want to see?" + }, { "id": "showTikTokGifts", "label": "Gifts",