diff --git a/horizontal-chat/icons/badges/twitch-channel-point.png b/horizontal-chat/icons/badges/twitch-channel-point.png new file mode 100644 index 0000000..67d0a3e Binary files /dev/null and b/horizontal-chat/icons/badges/twitch-channel-point.png differ diff --git a/horizontal-chat/script.js b/horizontal-chat/script.js index 51b3869..0e7f879 100644 --- a/horizontal-chat/script.js +++ b/horizontal-chat/script.js @@ -34,6 +34,7 @@ const ignoreChatters = urlParams.get("ignoreChatters") || ""; const showTwitchMessages = GetBooleanParam("showTwitchMessages", true); const showTwitchAnnouncements = GetBooleanParam("showTwitchAnnouncements", true); const showTwitchSubs = GetBooleanParam("showTwitchSubs", true); +const showTwitchChannelPointRedemptions = GetBooleanParam("showTwitchChannelPointRedemptions", true); const showTwitchRaids = GetBooleanParam("showTwitchRaids", true); const showYouTubeMessages = GetBooleanParam("showYouTubeMessages", true); @@ -108,6 +109,11 @@ client.on('Twitch.GiftBomb', (response) => { TwitchGiftBomb(response.data); }) +client.on('Twitch.RewardRedemption', (response) => { + console.debug(response.data); + TwitchRewardRedemption(response.data); +}) + client.on('Twitch.Raid', (response) => { console.debug(response.data); TwitchRaid(response.data); @@ -396,6 +402,21 @@ async function TwitchGiftBomb(data) { ShowAlert(message, 'twitch'); } +async function TwitchRewardRedemption(data) { + if (!showTwitchChannelPointRedemptions) + return; + + const username = data.user_name; + const rewardName = data.reward.title; + const cost = data.reward.cost; + const userInput = data.user_input; + const channelPointIcon = ``; + + let message = `${username} redeemed ${rewardName} ${channelPointIcon} ${cost}`; + + ShowAlert(message, 'twitch'); +} + async function TwitchRaid(data) { if (!showTwitchRaids) return; diff --git a/horizontal-chat/settings/settings.json b/horizontal-chat/settings/settings.json index cb27829..6ba5d62 100644 --- a/horizontal-chat/settings/settings.json +++ b/horizontal-chat/settings/settings.json @@ -124,6 +124,14 @@ "defaultValue": true, "group": "Which Twitch messages do you want to see?" }, + { + "id": "showTwitchChannelPointRedemptions", + "label": "Channel Point Redemptions", + "description": "", + "type": "checkbox", + "defaultValue": true, + "group": "Which Twitch messages do you want to see?" + }, { "id": "showTwitchRaids", "label": "Raids",