Added support for Twitch Channel Point Rewards

This commit is contained in:
nuttylmao
2025-03-27 04:00:34 +11:00
parent 67a3d46e7b
commit 8774d44397
3 changed files with 29 additions and 0 deletions
+21
View File
@@ -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 = `<img src="icons/badges/twitch-channel-point.png" class="platform"/>`;
let message = `${username} redeemed ${rewardName} ${channelPointIcon} ${cost}`;
ShowAlert(message, 'twitch');
}
async function TwitchRaid(data) {
if (!showTwitchRaids)
return;