diff --git a/.common/core/settings-core/script.js b/.common/core/settings-core/script.js
index 339f7a8..3e76669 100644
--- a/.common/core/settings-core/script.js
+++ b/.common/core/settings-core/script.js
@@ -70,6 +70,12 @@ function LoadJSON(settingsJson) {
settingItem.classList.add('setting-item');
settingItem.id = `item-${setting.id}`;
+ // Indent settings that are dependent on other settings using the showIf property
+ if (setting.showIf) {
+ const depth = GetSettingDepth(setting, data.settings);
+ settingItem.style.marginLeft = `${depth * 20}px`;
+ }
+
const labelDescriptionDiv = document.createElement('div');
if (setting.label) {
@@ -469,6 +475,18 @@ window.addEventListener('message', (event) => {
}
});
+function GetSettingDepth(setting, allSettings) {
+ let depth = 0;
+ let current = setting;
+
+ while (current.showIf) {
+ depth++;
+ current = allSettings.find(s => s.id === current.showIf) || {};
+ }
+
+ return depth;
+}
+
diff --git a/.common/core/settings-core/style.css b/.common/core/settings-core/style.css
index bbfbf7e..87b86ba 100644
--- a/.common/core/settings-core/style.css
+++ b/.common/core/settings-core/style.css
@@ -53,6 +53,7 @@ body {
height: 100%;
padding: 0px 20px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 1);
+ z-index: 2;
}
#settingsPanel::-webkit-scrollbar {
@@ -82,6 +83,16 @@ body {
flex-grow: 1;
overflow: hidden;
position: relative;
+
+ /* Dark Checkerboard Pattern */
+ background-color: #181818; /* The "base" dark color */
+ background-image: conic-gradient(
+ #252525 90deg,
+ #181818 90deg 180deg,
+ #252525 180deg 270deg,
+ #181818 270deg
+ );
+ background-size: 30px 30px; /* Size of the squares */
}
#widgetPreview {
diff --git a/.common/styles/global.css b/.common/styles/global.css
index 1f4bca5..9cd07b1 100644
--- a/.common/styles/global.css
+++ b/.common/styles/global.css
@@ -28,7 +28,7 @@ body {
padding: 0;
font-family: Inter, system-ui, sans-serif;
/* font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; */
- /* font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif; */
+ /* font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif; */
color: white;
background-color: var(--background-color);
}
@@ -311,6 +311,17 @@ iframe {
/*** DIALOG ***/
/**************/
+.dialog-wrapper {
+ position: fixed;
+ width: 100%;
+ height: 100%;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ z-index: 1000;
+ backdrop-filter: blur(var(--blur-intensity));
+}
+
.dialog {
font-size: 1em;
background-color: var(--dialog-background);
@@ -327,7 +338,7 @@ iframe {
border: 1px solid #40404080;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
z-index: 1000;
- /* above overlay */
+ backdrop-filter: blur(var(--blur-intensity));
}
.dialog-nav-button {
@@ -384,4 +395,98 @@ select {
color: #fff;
cursor: pointer;
min-width: 8em;
+}
+
+/***************/
+/*** SIDEBAR ***/
+/***************/
+
+#sidebar {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 250px;
+ /* expanded width */
+ height: 100vh;
+ color: #fff;
+ overflow: hidden;
+ transition: width 0.3s ease;
+ backdrop-filter: blur(var(--blur-intensity));
+ /* <-- adds the blur */
+ box-shadow: 0 0 10px rgba(0, 0, 0, 1);
+}
+
+#sidebar.collapsed {
+ width: 3em;
+ /* collapsed width */
+}
+
+#sidebar button {
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ gap: 0.5em;
+ padding: 0.5em 1em;
+ border-radius: 0;
+}
+
+#sidebar .sidebar-menu {
+ opacity: 1;
+ transition: opacity 0.3s ease;
+}
+
+#sidebar.collapsed .sidebar-menu {
+ opacity: 1;
+}
+
+#collapse-sidebar-btn {
+ width: 100%;
+ background: none;
+ border: none;
+ color: #fff;
+ cursor: pointer;
+ justify-content: flex-end !important;
+}
+
+.sidebar-item {
+ padding: 0.75em 1em;
+ text-align: left;
+ background: none;
+ border: none;
+ color: inherit;
+ font-size: 1em;
+ cursor: pointer;
+ white-space: nowrap;
+ /* prevent line breaks */
+ overflow: hidden;
+ /* hide overflow text */
+ text-overflow: ellipsis;
+ /* optional: show "..." if needed */
+}
+
+#sidebar.collapsed .sidebar-item {
+ justify-content: center;
+ padding: 0.75em 0;
+}
+
+.sidebar-label {
+ display: inline-block;
+}
+
+#sidebar.collapsed .sidebar-label {
+ display: none;
+}
+
+.sidebar-item svg {
+ width: 1em;
+ height: 1em;
+ flex-shrink: 0;
+}
+
+.sidebar-spacer {
+ flex: 1;
+}
+
+.sidebar-item:hover {
+ background-color: #333;
}
\ No newline at end of file
diff --git a/.common/templates/poll-response-template.css b/.common/templates/poll-response-template.css
new file mode 100644
index 0000000..29ef7b5
--- /dev/null
+++ b/.common/templates/poll-response-template.css
@@ -0,0 +1,95 @@
+:root {
+ --winning-color: #3be47680;
+ --vote-bar-color: #FFFFFF;
+ --vote-bar-track-color: #FFFFFF33;
+}
+
+.response-container {
+ display: flex;
+ align-items: center;
+ gap: 0.75em;
+ width: 100%;
+ transition: all 0.8s ease;
+}
+
+.response-index {
+ width: 2.5em;
+ height: 2.5em;
+ min-width: 2.5em;
+ border-radius: 50%;
+ background-color: rgba(255, 255, 255, 0.15);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-weight: 900;
+ font-size: 0.8em;
+ transition: all 0.8s ease-out;
+}
+
+.response-except-just-the-shit-on-the-right-side {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 0.25em;
+ min-width: 0;
+}
+
+.response-title,
+.response-votes {
+ position: relative;
+ z-index: 1;
+ display: flex;
+ align-items: center;
+ line-height: 1.2em;
+ /* mix-blend-mode: exclusion; */ /* I couldn't make this shit look good so I'm turning it off for now */
+}
+
+.response-title {
+ flex: 1 1 auto;
+ min-width: 0;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.response-votes {
+ flex: 0 0 auto;
+ white-space: nowrap;
+ margin-left: 8px;
+ font-size: 0.8em;
+}
+
+.response-bar-track {
+ background-color: var(--vote-bar-track-color);
+ position: relative;
+ display: flex;
+ border-radius: 0.5em;
+ overflow: hidden;
+ padding: 0.5em 0.5em;
+}
+
+.response-bar-fill {
+ position: absolute; /* take it out of flex flow */
+ top: 0;
+ left: 0;
+ height: 100%;
+ width: 100%;
+ background-color: var(--vote-bar-color);
+ transition: all 0.25s ease;
+ z-index: 0; /* sits behind text */
+ inset: 0;
+ display: flex; /* 👈 KEY CHANGE */
+ overflow: hidden;
+}
+
+.trophy-icon {
+ width: 1.8em;
+ height: 1.8em;
+ vertical-align: middle;
+}
+
+.response-bar-segment {
+ height: 100%;
+ flex-shrink: 0;
+ transition: all 0.25s ease;
+}
\ No newline at end of file
diff --git a/.common/templates/poll-response-template.html b/.common/templates/poll-response-template.html
new file mode 100644
index 0000000..5998cb6
--- /dev/null
+++ b/.common/templates/poll-response-template.html
@@ -0,0 +1,16 @@
+
+
+
\ No newline at end of file
diff --git a/.common/utils/helpers.js b/.common/utils/helpers.js
index 4c4d0f1..a54e3ae 100644
--- a/.common/utils/helpers.js
+++ b/.common/utils/helpers.js
@@ -118,25 +118,59 @@ async function GetAvatar(username, platform) {
console.debug(`No avatar found for ${username} (${platform}). Retrieving from Kick.`);
let url = `https://kick.com/api/v2/channels/${username}`;
+
try {
let response = await fetch(url);
if (!response.ok) {
- // Retry with underscores replaced by dashes
const altUsername = username.replace(/_/g, "-");
url = `https://kick.com/api/v2/channels/${altUsername}`;
response = await fetch(url);
+
if (!response.ok) {
throw new Error(`HTTP error ${response.status}`);
}
}
let data = await response.json();
- let avatarURL = data.user?.profile_pic || 'https://kick.com/img/default-profile-pictures/default2.jpeg';
+
+ const defaultAvatars = [
+ 'https://kick.com/img/default-profile-pictures/default-avatar-1.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-2.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-3.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-4.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-5.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-6.webp',
+ ];
+
+ const avatarURL =
+ data.user?.profile_pic ||
+ defaultAvatars[hashString(`${username}-${platform}`) % defaultAvatars.length];
+
avatarMap.set(`${username}-${platform}`, avatarURL);
return avatarURL;
+
} catch (error) {
console.error("Failed to fetch avatar:", error.message);
- return 'https://kick.com/img/default-profile-pictures/default2.jpeg';
+
+ const defaultAvatars = [
+ 'https://kick.com/img/default-profile-pictures/default-avatar-1.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-2.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-3.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-4.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-5.webp',
+ 'https://kick.com/img/default-profile-pictures/default-avatar-6.webp',
+ ];
+
+ return defaultAvatars[hashString(`${username}-${platform}`) % defaultAvatars.length];
+ }
+
+ function hashString(str) {
+ let hash = 0;
+ for (let i = 0; i < str.length; i++) {
+ hash = ((hash << 5) - hash) + str.charCodeAt(i);
+ hash |= 0; // convert to 32-bit int
+ }
+ return Math.abs(hash);
}
}
}
@@ -301,6 +335,15 @@ function ConstructMessageFromParts(parts) {
case "text":
return EscapeHTML(part.text);
case "cheer":
+ // TODO: It seems like Streamer.bot v1.0.5-alpha3 doesn't include the imageUrl for bits in the message parts, only the bits count. We may need to hardcode the image URL format for Twitch bits, or find another way to retrieve it.
+ let imageUrl = '';
+
+ if (!part.imageUrl) {
+ const tiers = [100000, 10000, 5000, 1000, 100, 10, 1];
+ const activeTier = tiers.find(tier => part.bits >= tier) || 1;
+ part.imageUrl = `https://d3aqoihi2n8ty8.cloudfront.net/actions/cheer/dark/animated/${activeTier}/4.gif`;
+ }
+
// Render the cheer emote image
const emoteImg = `
`;
@@ -308,6 +351,8 @@ function ConstructMessageFromParts(parts) {
const bitLabel = `${EscapeHTML(part.bits.toString())}`;
return emoteImg + bitLabel;
+ case "mention":
+ return part.text;
default:
return `
`;
}
diff --git a/horizontal-chat/icons/badges/twitch-bit.svg b/horizontal-chat/icons/badges/twitch-bit.svg
new file mode 100644
index 0000000..5fcda08
--- /dev/null
+++ b/horizontal-chat/icons/badges/twitch-bit.svg
@@ -0,0 +1,7 @@
+
+
+
diff --git a/horizontal-chat/script.js b/horizontal-chat/script.js
index 1d429e8..f5fc40f 100644
--- a/horizontal-chat/script.js
+++ b/horizontal-chat/script.js
@@ -46,6 +46,7 @@ const showTwitchAnnouncements = GetBooleanParam("showTwitchAnnouncements", true)
const showTwitchFollows = GetBooleanParam("showTwitchFollows", false);
const showTwitchSubs = GetBooleanParam("showTwitchSubs", true);
const showTwitchChannelPointRedemptions = GetBooleanParam("showTwitchChannelPointRedemptions", true);
+const showTwitchPowerUpRedemptions = GetBooleanParam("showTwitchPowerUpRedemptions", true);
const showTwitchRaids = GetBooleanParam("showTwitchRaids", true);
const showTwitchWatchStreaks = GetBooleanParam("showTwitchWatchStreaks", true);
const showTwitchSharedChat = GetBooleanParam("showTwitchSharedChat", true);
@@ -85,7 +86,9 @@ const animationSpeed = GetIntParam("animationSpeed", 0.5);
const randomYouTubeColors = GetBooleanParam("randomYouTubeColors", false);
const youtubeColor = urlParams.get("youtubeColor") || "#f70000";
const youtubeCustomSubIcon = urlParams.get("youtubeCustomSubIcon") || "";
-const kickUsername = urlParams.get("kickUsername") || "";
+let twitchUsername = urlParams.get("twitchUsername") || "";
+let kickUsername = urlParams.get("kickUsername") || "";
+let youtubeUsername = urlParams.get("youtubeUsername") || "";
@@ -179,6 +182,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);
@@ -343,12 +351,18 @@ client.on('Fourthwall.GiftDrawEnded', (response) => {
// Connect and handle Pusher WebSocket
async function KickConnect() {
+ // Fetch from Streamer.bot
+ const broadcasterInfo = await client.getBroadcaster();
+
+ // This code has nothing to do with Kick, but it's a really good place to get Twitch and YouTube usernames as well, because I'm built different like that
+ if (broadcasterInfo.platforms.twitch)
+ twitchUsername = broadcasterInfo.platforms.twitch.broadcastUserName;
+ if (broadcasterInfo.platforms.youtube)
+ youtubeUsername = broadcasterInfo.platforms.youtube.broadcastUserName;
+
// If user has not manually set Kick username, try to grab if from Streamer.bot
if (!kickUsername)
- {
- // Fetch from Streamer.bot
- const broadcasterInfo = await client.getBroadcaster();
-
+ {
if (broadcasterInfo.platforms.kick)
kickUsername = broadcasterInfo.platforms.kick.broadcasterLogin;
else
@@ -504,11 +518,11 @@ async function TwitchChatMessage(data) {
return;
// Don't post messages starting with "!"
- if (data.message.message.startsWith("!") && excludeCommands)
+ if (data.text.startsWith("!") && excludeCommands)
return;
// Don't post messages from users from the ignore list
- if (ignoreUserList.includes(data.message.username.toLowerCase()))
+ if (ignoreUserList.includes(data.user.login.toLowerCase()))
return;
// Get a reference to the template
@@ -544,15 +558,15 @@ async function TwitchChatMessage(data) {
// Set the username info
if (showUsername) {
- if (data.message.displayName.toLowerCase() == data.message.username.toLowerCase())
- usernameDiv.innerText = data.message.displayName;
+ if (data.user.name.toLowerCase() == data.user.login.toLowerCase())
+ usernameDiv.innerText = data.user.name;
else
- usernameDiv.innerText = `${data.message.displayName} (${data.message.username})`;
- usernameDiv.style.color = data.message.color;
+ usernameDiv.innerText = `${data.user.name} (${data.user.login})`;
+ usernameDiv.style.color = data.user.color;
}
// Set pronouns
- const pronouns = await GetPronouns('twitch', data.message.username);
+ const pronouns = await GetPronouns('twitch', data.user.login);
if (pronouns && showPronouns) {
pronounsDiv.classList.add("pronouns");
pronounsDiv.innerText = pronouns;
@@ -560,8 +574,8 @@ async function TwitchChatMessage(data) {
// Set the message data
let message = ConstructMessageFromParts(data.parts);
- const messageColor = data.message.color;
- const role = data.message.role;
+ const messageColor = data.user.color;
+ const role = data.user.role;
// Set furry mode
if (furryMode)
@@ -573,7 +587,7 @@ async function TwitchChatMessage(data) {
}
// Set the "action" color
- if (data.message.isMe)
+ if (data.meta.isMe)
messageDiv.style.color = messageColor;
// Render platform
@@ -585,9 +599,9 @@ async function TwitchChatMessage(data) {
// Render badges
if (showBadges) {
badgeListDiv.innerHTML = "";
- for (i in data.message.badges) {
+ for (i in data.user.badges) {
const badge = new Image();
- badge.src = data.message.badges[i].imageUrl;
+ badge.src = data.user.badges[i].imageUrl;
badge.classList.add("badge");
badgeListDiv.appendChild(badge);
}
@@ -595,7 +609,7 @@ async function TwitchChatMessage(data) {
// Render avatars
if (showAvatar) {
- const username = data.message.username;
+ const username = data.user.login;
const avatarURL = await GetAvatar(username, 'twitch');
const avatar = new Image();
avatar.src = avatarURL;
@@ -604,7 +618,7 @@ async function TwitchChatMessage(data) {
}
// Custom styling for subs
- if (data.message.subscriber) {
+ if (data.user.subscribed) {
usernameDiv.classList.add('sub-glow')
}
@@ -623,7 +637,7 @@ async function TwitchChatMessage(data) {
userInfoDiv.style.display = "none";
}
- AddMessageItem(instance, data.message.msgId, 'twitch', data.user.id);
+ AddMessageItem(instance, data.messageId, 'twitch', data.user.id);
}
async function TwitchCheer(data) {
@@ -780,6 +794,23 @@ async function TwitchRewardRedemption(data) {
ShowAlert(message, 'twitch');
}
+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.customPowerUp.title;
+ const cost = data.customPowerUp.bits;
+ const userInput = data.userInput;
+ const bitIcon = `
`;
+
+ let message = `${username} redeemed ${powerUpName} ${bitIcon} ${cost}`;
+
+ ShowAlert(message, 'twitch');
+}
+
async function TwitchRaid(data) {
if (!showTwitchRaids)
return;
@@ -798,8 +829,9 @@ async function TwitchWatchStreak(data) {
if (!showTwitchWatchStreaks)
return;
- const displayName = data.displayName;
- const watchStreak = data.watchStreak;
+ // TODO: Streamer.bot v1.0.5-alpha3 changed the data sent with this event, so for backwards compatibility we need to check for both the old and new properties
+ const displayName = data.displayName ?? data.user.name;
+ const watchStreak = data.watchStreak ?? data.streak_count;
let message = `${displayName} is currently on a ${watchStreak} stream streak!`;
diff --git a/horizontal-chat/settings/settings.json b/horizontal-chat/settings/settings.json
index bf48dea..a984361 100644
--- a/horizontal-chat/settings/settings.json
+++ b/horizontal-chat/settings/settings.json
@@ -175,6 +175,14 @@
"defaultValue": true,
"group": "Which Twitch messages do you want to see?"
},
+ {
+ "id": "showTwitchPowerUpRedemptions",
+ "label": "Power-Up Redemptions",
+ "description": "",
+ "type": "checkbox",
+ "defaultValue": true,
+ "group": "Which Twitch messages do you want to see?"
+ },
{
"id": "showTwitchRaids",
"label": "Raids",
diff --git a/multichat-overlay/icons/badges/twitch-bit.svg b/multichat-overlay/icons/badges/twitch-bit.svg
new file mode 100644
index 0000000..5fcda08
--- /dev/null
+++ b/multichat-overlay/icons/badges/twitch-bit.svg
@@ -0,0 +1,7 @@
+
+
+
diff --git a/multichat-overlay/script.js b/multichat-overlay/script.js
index 23f6c1d..49afc56 100644
--- a/multichat-overlay/script.js
+++ b/multichat-overlay/script.js
@@ -42,6 +42,7 @@ const ignoreChatters = urlParams.get("ignoreChatters") || "";
const scrollDirection = GetIntParam("scrollDirection", 1);
const groupConsecutiveMessages = GetBooleanParam("groupConsecutiveMessages", false);
const inlineChat = GetBooleanParam("inlineChat", false);
+const highlightMentions = GetBooleanParam("highlightMentions", true);
const imageEmbedPermissionLevel = GetIntParam("imageEmbedPermissionLevel", 20);
const showYouTubeLinkPreviews = GetBooleanParam("showYouTubeLinkPreviews", true);
@@ -51,6 +52,7 @@ const showTwitchAnnouncements = GetBooleanParam("showTwitchAnnouncements", true)
const showTwitchFollows = GetBooleanParam("showTwitchFollows", false);
const showTwitchSubs = GetBooleanParam("showTwitchSubs", true);
const showTwitchChannelPointRedemptions = GetBooleanParam("showTwitchChannelPointRedemptions", true);
+const showTwitchPowerUpRedemptions = GetBooleanParam("showTwitchPowerUpRedemptions", true);
const showTwitchRaids = GetBooleanParam("showTwitchRaids", true);
const showTwitchWatchStreaks = GetBooleanParam("showTwitchWatchStreaks", true);
const showTwitchSharedChat = GetIntParam("showTwitchSharedChat", 2);
@@ -91,7 +93,9 @@ const animationSpeed = GetIntParam("animationSpeed", 0.1);
const randomYouTubeColors = GetBooleanParam("randomYouTubeColors", false);
const youtubeColor = urlParams.get("youtubeColor") || "#f70000";
const youtubeCustomSubIcon = urlParams.get("youtubeCustomSubIcon") || "";
+let twitchUsername = urlParams.get("twitchUsername") || "";
let kickUsername = urlParams.get("kickUsername") || "";
+let youtubeUsername = urlParams.get("youtubeUsername") || "";
@@ -199,6 +203,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);
@@ -383,12 +392,20 @@ client.on('Fourthwall.GiftDrawEnded', (response) => {
// Connect and handle Pusher WebSocket
async function KickConnect() {
+ // Fetch from Streamer.bot
+ const broadcasterInfo = await client.getBroadcaster();
+
+ console.log('Broadcaster info:', broadcasterInfo);
+
+ // This code has nothing to do with Kick, but it's a really good place to get Twitch and YouTube usernames as well, because I'm built different like that
+ if (broadcasterInfo.platforms.twitch)
+ twitchUsername = broadcasterInfo.platforms.twitch.broadcastUserName;
+ if (broadcasterInfo.platforms.youtube)
+ youtubeUsername = broadcasterInfo.platforms.youtube.broadcastUserName;
+
// If user has not manually set Kick username, try to grab if from Streamer.bot
if (!kickUsername)
{
- // Fetch from Streamer.bot
- const broadcasterInfo = await client.getBroadcaster();
-
if (broadcasterInfo.platforms.kick)
kickUsername = broadcasterInfo.platforms.kick.broadcasterLogin;
else
@@ -551,11 +568,11 @@ async function TwitchChatMessage(data) {
return;
// Don't post messages starting with "!"
- if (data.message.message.startsWith("!") && excludeCommands)
+ if (data.text.startsWith("!") && excludeCommands)
return;
// Don't post messages from users from the ignore list
- if (ignoreUserList.includes(data.message.username.toLowerCase()))
+ if (ignoreUserList.includes(data.user.login.toLowerCase()))
return;
// Get a reference to the template
@@ -593,7 +610,7 @@ async function TwitchChatMessage(data) {
}
// Set First Time Chatter
- const firstMessage = data.message.firstMessage;
+ const firstMessage = data.meta.firstMessage;
if (firstMessage && showMessage) {
firstMessageDiv.style.display = 'block';
messageContainerDiv.classList.add("highlightMessage");
@@ -622,10 +639,10 @@ async function TwitchChatMessage(data) {
}
// Set Reply Message
- const isReply = data.message.isReply;
+ const isReply = data.isReply;
if (isReply && showMessage) {
- const replyUser = data.message.reply.userName;
- const replyMsg = data.message.reply.msgBody;
+ const replyUser = data.reply.userName;
+ const replyMsg = data.reply.msgBody;
replyDiv.style.display = 'block';
replyUserDiv.innerText = replyUser;
@@ -640,15 +657,15 @@ async function TwitchChatMessage(data) {
// Set the username info
if (showUsername) {
- if (data.message.displayName.toLowerCase() == data.message.username.toLowerCase())
- usernameDiv.innerText = data.message.displayName;
+ if (data.user.name.toLowerCase() == data.user.login.toLowerCase())
+ usernameDiv.innerText = data.user.name;
else
- usernameDiv.innerText = `${data.message.displayName} (${data.message.username})`;
- usernameDiv.style.color = data.message.color;
+ usernameDiv.innerText = `${data.user.name} (${data.user.login})`;
+ usernameDiv.style.color = data.user.color;
}
// Set pronouns
- const pronouns = await GetPronouns('twitch', data.message.username);
+ const pronouns = await GetPronouns('twitch', data.user.login);
if (pronouns && showPronouns) {
pronounsDiv.classList.add("pronouns");
pronounsDiv.innerText = pronouns;
@@ -656,8 +673,14 @@ async function TwitchChatMessage(data) {
// Set the message data
let message = ConstructMessageFromParts(data.parts);
- const messageColor = data.message.color;
- const role = data.message.role;
+ const messageColor = data.user.color;
+ const role = data.user.role;
+
+ // Highlight mentions
+ const mentionRgx = new RegExp(`(^|\\s)@${twitchUsername}(\\s|$)`, 'i');
+ const mention = mentionRgx.test(data.text);
+ if (mention && highlightMentions && showMessage)
+ messageContainerDiv.classList.add("highlightMessage");
// Set furry mode
if (furryMode)
@@ -669,7 +692,7 @@ async function TwitchChatMessage(data) {
}
// Set the "action" color
- if (data.message.isMe)
+ if (data.meta.isMe)
messageDiv.style.color = messageColor;
// Remove the line break
@@ -688,9 +711,9 @@ async function TwitchChatMessage(data) {
// Render badges
if (showBadges) {
badgeListDiv.innerHTML = "";
- for (i in data.message.badges) {
+ for (i in data.user.badges) {
const badge = new Image();
- badge.src = data.message.badges[i].imageUrl;
+ badge.src = data.user.badges[i].imageUrl;
badge.classList.add("badge");
badgeListDiv.appendChild(badge);
}
@@ -698,7 +721,7 @@ async function TwitchChatMessage(data) {
// Render avatars
if (showAvatar) {
- const username = data.message.username;
+ const username = data.user.login;
const avatarURL = await GetAvatar(username, 'twitch');
const avatar = new Image();
avatar.src = avatarURL;
@@ -707,7 +730,7 @@ async function TwitchChatMessage(data) {
}
// Custom styling for subs
- if (data.message.subscriber) {
+ if (data.user.subscribed) {
usernameDiv.classList.add('sub-glow')
}
@@ -740,7 +763,7 @@ async function TwitchChatMessage(data) {
messageDiv.innerHTML = '';
messageDiv.appendChild(image);
- AddMessageItem(instance, data.message.msgId, 'twitch', data.user.id);
+ AddMessageItem(instance, data.messageId, 'twitch', data.user.id);
};
const urlObj = new URL(message);
@@ -750,7 +773,7 @@ async function TwitchChatMessage(data) {
image.src = "https://external-content.duckduckgo.com/iu/?u=" + urlObj.toString();
}
else {
- AddMessageItem(instance, data.message.msgId, 'twitch', data.user.id);
+ AddMessageItem(instance, data.messageId, 'twitch', data.user.id);
}
// Render YouTube links
@@ -1153,6 +1176,57 @@ async function TwitchRewardRedemption(data) {
AddMessageItem(instance, data.messageId);
}
+async function TwitchCustomPowerUpRedemption(data) {
+ if (!showTwitchPowerUpRedemptions)
+ return;
+
+ // Get a reference to the template
+ const template = document.getElementById('cardTemplate');
+
+ // Create a new instance of the template
+ const instance = template.content.cloneNode(true);
+
+ // Get divs
+ const cardDiv = instance.querySelector("#card");
+ const headerDiv = instance.querySelector("#header");
+ const avatarDiv = instance.querySelector("#avatar");
+ const iconDiv = instance.querySelector("#icon");
+ const titleDiv = instance.querySelector("#title");
+ const contentDiv = instance.querySelector("#content");
+
+ // Set the card background colors
+ // cardDiv.classList.add('twitch');
+ const baseColor = data.customPowerUp.backgroundColor; // e.g., #3498db
+
+ // B3 = 70% opacity
+ // FF = 100% opacity
+ cardDiv.style.background = `linear-gradient(180deg, ${baseColor}B3 0%, ${baseColor}FF 100%)`;
+
+ if (showAvatar) {
+ // Render avatars
+ const username = data.user.login;
+ const avatarURL = await GetAvatar(username, 'twitch');
+ const avatar = new Image();
+ avatar.src = avatarURL;
+ avatar.classList.add("avatar");
+ avatarDiv.appendChild(avatar);
+ }
+
+ // 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 powerUpName = data.customPowerUp.title;
+ const cost = data.customPowerUp.bits;
+ const userInput = data.userInput;
+ const bitIcon = `
`;
+
+ titleDiv.innerHTML = `${username} redeemed ${powerUpName} ${bitIcon} ${cost}`;
+ contentDiv.innerText = `${userInput}`;
+
+ AddMessageItem(instance, data.messageId);
+}
+
async function TwitchRaid(data) {
if (!showTwitchRaids)
return;
@@ -1220,20 +1294,20 @@ async function TwitchWatchStreak(data) {
if (showAvatar) {
// Render avatars
- const username = data.userName;
+ const username = data.user.login;
const avatarURL = await GetAvatar(username, 'twitch');
const avatar = new Image();
avatar.src = avatarURL;
avatar.classList.add("avatar");
avatarDiv.appendChild(avatar);
}
-
- const displayName = data.displayName;
- const watchStreak = data.watchStreak;
- const message = RenderMessageWithEmotesHTML(data.message, data.emotes);
+
+ // TODO: Streamer.bot v1.0.5-alpha3 changed the data sent with this event, so for backwards compatibility we need to check for both the old and new properties
+ const displayName = data.displayName ?? data.user.name;
+ const watchStreak = data.watchStreak ?? data.streak_count;
titleDiv.innerText = `${displayName} is currently on a ${watchStreak} stream streak! `;
- contentDiv.innerHTML = message;
+ contentDiv.innerHTML = ConstructMessageFromParts(data.parts);
AddMessageItem(instance, data.messageId);
}
@@ -1352,6 +1426,12 @@ async function YouTubeMessage(data) {
//let message = RenderMessageWithEmotesHTML(data.message, data.emotes);
let message = ConstructMessageFromParts(data.parts);
+ // Highlight mentions
+ const mentionRgx = new RegExp(`(^|\\s)@${youtubeUsername}(\\s|$)`, 'i');
+ const mention = mentionRgx.test(message);
+ if (mention && highlightMentions && showMessage)
+ messageContainerDiv.classList.add("highlightMessage");
+
// Set furry mode
if (furryMode)
message = TranslateToFurry(message);
@@ -2300,8 +2380,8 @@ async function KickChatMessage(data) {
// Set Reply Message
const isReply = data.isReply;
if (isReply && showMessage) {
- const replyUser = data.reply.sender.name;
- const replyMsg = data.reply.content;
+ const replyUser = data.reply.userName;
+ const replyMsg = data.reply.msgBody;
replyDiv.style.display = 'block';
replyUserDiv.innerText = replyUser;
@@ -2326,7 +2406,7 @@ async function KickChatMessage(data) {
// Highlight mentions
const mentionRgx = new RegExp(`(^|\\s)@${kickUsername}(\\s|$)`, 'i');
const mention = mentionRgx.test(message);
- if (mention && showMessage)
+ if (mention && highlightMentions && showMessage)
messageContainerDiv.classList.add("highlightMessage");
// Set furry mode
@@ -3171,13 +3251,13 @@ function IsThisUserAllowedToPostImagesOrNotReturnTrueIfTheyCanReturnFalseIfTheyC
function GetPermissionLevel(data, platform) {
switch (platform) {
case 'twitch':
- if (data.message.role >= 4)
+ if (data.user.role >= 4)
return 40;
- else if (data.message.role >= 3)
+ else if (data.user.role >= 3)
return 30;
- else if (data.message.role >= 2)
+ else if (data.user.role >= 2)
return 20;
- else if (data.message.role >= 2 || data.message.subscriber)
+ else if (data.user.role >= 2 || data.user.subscribed)
return 15;
else
return 10;
diff --git a/multichat-overlay/settings/settings.json b/multichat-overlay/settings/settings.json
index 68d2f89..6c53129 100644
--- a/multichat-overlay/settings/settings.json
+++ b/multichat-overlay/settings/settings.json
@@ -192,6 +192,14 @@
"defaultValue": false,
"group": "General"
},
+ {
+ "id": "highlightMentions",
+ "label": "Highlight Mentions",
+ "description": "Highlight messages that mention the streamer",
+ "type": "checkbox",
+ "defaultValue": true,
+ "group": "General"
+ },
{
"id": "imageEmbedPermissionLevel",
"label": "Embed Images",
@@ -282,6 +290,14 @@
"defaultValue": true,
"group": "Which Twitch messages do you want to see?"
},
+ {
+ "id": "showTwitchPowerUpRedemptions",
+ "label": "Power-Up Redemptions",
+ "description": "",
+ "type": "checkbox",
+ "defaultValue": true,
+ "group": "Which Twitch messages do you want to see?"
+ },
{
"id": "showTwitchRaids",
"label": "Raids",
diff --git a/multistream-alerts/icons/badges/twitch-bit.svg b/multistream-alerts/icons/badges/twitch-bit.svg
new file mode 100644
index 0000000..5fcda08
--- /dev/null
+++ b/multistream-alerts/icons/badges/twitch-bit.svg
@@ -0,0 +1,7 @@
+
+
+
diff --git a/multistream-alerts/script.js b/multistream-alerts/script.js
index ed91179..f141c4b 100644
--- a/multistream-alerts/script.js
+++ b/multistream-alerts/script.js
@@ -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);
@@ -115,7 +117,9 @@ const fourthwallAlertAction = urlParams.get("fourthwallAlertAction") || "";
// HIDDEN OPTIONS //
////////////////////
+let twitchUsername = urlParams.get("twitchUsername") || "";
let kickUsername = urlParams.get("kickUsername") || "";
+let youtubeUsername = urlParams.get("youtubeUsername") || "";
// Set avatar visibility
if (!showAvatar) {
@@ -216,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);
@@ -324,12 +333,18 @@ client.on('Fourthwall.GiftDrawEnded', (response) => {
// Connect and handle Pusher WebSocket
async function KickConnect() {
+ // Fetch from Streamer.bot
+ const broadcasterInfo = await client.getBroadcaster();
+
+ // This code has nothing to do with Kick, but it's a really good place to get Twitch and YouTube usernames as well, because I'm built different like that
+ if (broadcasterInfo.platforms.twitch)
+ twitchUsername = broadcasterInfo.platforms.twitch.broadcastUserName;
+ if (broadcasterInfo.platforms.youtube)
+ youtubeUsername = broadcasterInfo.platforms.youtube.broadcastUserName;
+
// If user has not manually set Kick username, try to grab if from Streamer.bot
if (!kickUsername)
- {
- // Fetch from Streamer.bot
- const broadcasterInfo = await client.getBroadcaster();
-
+ {
if (broadcasterInfo.platforms.kick)
kickUsername = broadcasterInfo.platforms.kick.broadcasterLogin;
else
@@ -494,7 +509,7 @@ async function TwitchCheer(data) {
return;
// Set the text
- const username = data.message.displayName;
+ const username = data.user.login;
const bits = data.bits;
let message = ConstructMessageFromParts(data.parts);
@@ -688,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.customPowerUp.title;
+ const cost = data.customPowerUp.bits;
+ const userInput = data.userInput;
+ const bitIcon = `
`;
+
+ // Render avatars
+ const avatarURL = await GetAvatar(data.user.login, 'twitch');
+
+ UpdateAlertBox(
+ 'twitch',
+ avatarURL,
+ `${username} redeemed`,
+ `${powerUpName} ${bitIcon} ${cost}`,
+ '',
+ username,
+ userInput,
+ twitchPowerUpRedemptionAction,
+ data
+ );
+}
+
async function TwitchRaid(data) {
if (!showTwitchRaids)
return;
@@ -717,19 +760,20 @@ async function TwitchWatchStreak(data) {
return;
// Render avatars
- const avatarURL = await GetAvatar(data.userName, 'twitch');
+ const avatarURL = await GetAvatar(data.user.login, 'twitch');
// Set the text
- const username = data.displayName;
- const watchStreak = data.watchStreak;
+ // TODO: Streamer.bot v1.0.5-alpha3 changed the data sent with this event, so for backwards compatibility we need to check for both the old and new properties
+ const displayName = data.displayName ?? data.user.name;
+ const watchStreak = data.watchStreak ?? data.streak_count;
UpdateAlertBox(
'twitch',
avatarURL,
- `${username}`,
+ `${displayName}`,
`is currently on a ${watchStreak} stream streak!`,
'',
- username,
+ displayName,
'',
twitchWatchStreaksAction,
data
diff --git a/multistream-alerts/settings/settings.json b/multistream-alerts/settings/settings.json
index 61d4982..c919d79 100644
--- a/multistream-alerts/settings/settings.json
+++ b/multistream-alerts/settings/settings.json
@@ -278,6 +278,23 @@
"showIf": "showTwitchChannelPointRedemptions",
"group": "Which Twitch alerts do you want to see?"
},
+ {
+ "id": "showTwitchPowerUpRedemptions",
+ "label": "Power-Up Redemptions",
+ "description": "",
+ "type": "checkbox",
+ "defaultValue": true,
+ "group": "Which Twitch alerts do you want to see?"
+ },
+ {
+ "id": "twitchPowerUpRedemptionAction",
+ "label": "",
+ "description": "Also run this Streamer.bot Action",
+ "type": "sb-actions",
+ "defaultValue": "",
+ "showIf": "showTwitchPowerUpRedemptions",
+ "group": "Which Twitch alerts do you want to see?"
+ },
{
"id": "showTwitchCheers",
"label": "Cheers",
diff --git a/printer-bot/contents/script.js b/printer-bot/contents/script.js
index 0dc74f5..ccc444d 100644
--- a/printer-bot/contents/script.js
+++ b/printer-bot/contents/script.js
@@ -189,6 +189,54 @@ async function CustomEvent(data) {
SetPlatformIcon(iconEl, 'twitch');
}
break;
+ case ('TwitchCustomPowerUpRedemption'):
+ {
+ avatarEl.src = await GetAvatar(data.userName, 'twitch');
+ titleEl.innerText = `${data["customPowerUp.bits"]} BITS`;
+ subtitleEl.innerText = `${data.user}`;
+
+ const messageEl = document.createElement('div');
+ messageEl.innerHTML = data.rawInput;
+
+ // // Render emotes
+ // for (i in data.emotes) {
+ // const emoteElement = `
`;
+ // const emoteName = EscapeRegExp(data.emotes[i].name);
+ // function EscapeRegExp(string) {
+ // return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
+ // }
+
+ // let regexPattern = emoteName;
+
+ // // Check if the emote name consists only of word characters (alphanumeric and underscore)
+ // if (/^\w+$/.test(emoteName)) {
+ // regexPattern = `\\b${emoteName}\\b`;
+ // }
+ // else {
+ // // For non-word emotes, ensure they are surrounded by non-word characters or boundaries
+ // regexPattern = `(?<=^|[^\\w])${emoteName}(?=$|[^\\w])`;
+ // }
+
+ // const regex = new RegExp(regexPattern, 'g');
+ // messageEl.innerHTML = messageEl.innerHTML.replace(regex, emoteElement);
+ // }
+
+ // // Render cheermotes
+ // for (i in data.cheerEmotes) {
+ // const bits = data.cheerEmotes[i].bits;
+ // const imageUrl = data.cheerEmotes[i].imageUrl;
+ // const name = data.cheerEmotes[i].name;
+ // const cheerEmoteElement = `
`;
+ // const bitsElements = `${bits}`
+ // messageEl.innerHTML = messageEl.innerHTML.replace(new RegExp(`\\b${name}${bits}\\b`, 'i'), cheerEmoteElement + bitsElements);
+ // }
+
+ contentEl.appendChild(messageEl);
+
+ // Set the platform icon
+ SetPlatformIcon(iconEl, 'twitch');
+ }
+ break;
// YouTube Events
case ('YouTubeNewSponsor'):