mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-18 19:50:58 -04:00
Added support for Twitch Power Ups
This commit is contained in:
@@ -63,6 +63,8 @@ const showTwitchSubs = GetBooleanParam("showTwitchSubs", true);
|
||||
const twitchSubAction = urlParams.get("twitchSubAction") || "";
|
||||
const showTwitchChannelPointRedemptions = GetBooleanParam("showTwitchChannelPointRedemptions", true);
|
||||
const twitchChannelPointRedemptionAction = urlParams.get("twitchChannelPointRedemptionAction") || "";
|
||||
const showTwitchPowerUpRedemptions = GetBooleanParam("showTwitchPowerUpRedemptions", true);
|
||||
const twitchPowerUpRedemptionAction = urlParams.get("twitchPowerUpRedemptionAction") || "";
|
||||
const showTwitchCheers = GetBooleanParam("showTwitchCheers", true);
|
||||
const twitchCheerAction = urlParams.get("twitchCheerAction") || "";
|
||||
const showTwitchRaids = GetBooleanParam("showTwitchRaids", true);
|
||||
@@ -218,6 +220,11 @@ client.on('Twitch.RewardRedemption', (response) => {
|
||||
TwitchRewardRedemption(response.data);
|
||||
})
|
||||
|
||||
client.on('Twitch.CustomPowerUpRedemption', (response) => {
|
||||
console.debug(response.data);
|
||||
TwitchCustomPowerUpRedemption(response.data);
|
||||
})
|
||||
|
||||
client.on('Twitch.Raid', (response) => {
|
||||
console.debug(response.data);
|
||||
TwitchRaid(response.data);
|
||||
@@ -696,6 +703,34 @@ async function TwitchRewardRedemption(data) {
|
||||
);
|
||||
}
|
||||
|
||||
async function TwitchCustomPowerUpRedemption(data) {
|
||||
if (!showTwitchPowerUpRedemptions)
|
||||
return;
|
||||
|
||||
let username = data.user.name;
|
||||
if (data.user.name.toLowerCase() != data.user.login.toLowerCase())
|
||||
username = `${data.user.name} (${data.user.login})`;
|
||||
const powerUpName = data.custom_power_up.title;
|
||||
const cost = data.custom_power_up.bits_cost;
|
||||
const prompt = data.custom_power_up.prompt;
|
||||
const bitIcon = `<img src="icons/badges/twitch-bit.svg" class="platform" style="height: 1em"/>`;
|
||||
|
||||
// Render avatars
|
||||
const avatarURL = await GetAvatar(data.user.login, 'twitch');
|
||||
|
||||
UpdateAlertBox(
|
||||
'twitch',
|
||||
avatarURL,
|
||||
`${username} redeemed`,
|
||||
`${powerUpName} ${bitIcon} ${cost}`,
|
||||
'',
|
||||
username,
|
||||
prompt,
|
||||
twitchPowerUpRedemptionAction,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
async function TwitchRaid(data) {
|
||||
if (!showTwitchRaids)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user