Skip to content

Commit

Permalink
Small bugfix to raid detection
Browse files Browse the repository at this point in the history
It turns out all I had to do was update tmi.js.
  • Loading branch information
WhatAboutGaming authored Jan 19, 2022
1 parent 9f33fef commit 7bbf1f4
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 453 deletions.
14 changes: 12 additions & 2 deletions backend/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -1458,13 +1458,23 @@ chatLogger.on("raw_message", rawMessageLogger);
// client.join("channel_name"); // To join a channel?

function onRaid(channel, username, viewers, tags) {

let systemMsg = tags["system-msg"];
systemMsg = systemMsg.replace(/(\\s)+/ig, " ");
systemMsg = systemMsg.replace(/\s+/ig, " ");
/*
console.log("ONRAID");
console.log(channel);
console.log(username);
console.log(viewers);
console.log(tags);
*/
let randomColorName = Math.floor(Math.random() * defaultColors.length);
client.say(chatConfig.debug_channel, ".color " + defaultColorNames[randomColorName]);
client.action(chatConfig.debug_channel, new Date().toISOString() + " [RAID] channel=" + channel + ", username=" + username + ",viewers=" + viewers + ", tags=" + tags);
client.whisper(chatConfig.channel_owner, new Date().toISOString() + " [RAID] channel=" + channel + ", username=" + username + ",viewers=" + viewers + ", tags=" + tags);
//client.action(chatConfig.debug_channel, new Date().toISOString() + " [RAID] channel=" + channel + ", username=" + username + ",viewers=" + viewers + ", tags=" + tags);
//client.whisper(chatConfig.channel_owner, new Date().toISOString() + " [RAID] channel=" + channel + ", username=" + username + ",viewers=" + viewers + ", tags=" + tags);
//client.action(chatConfig.debug_channel, new Date().toISOString() + " [RAID] channel=" + channel + ", username=" + username + ",viewers=" + viewers + ", tags=" + JSON.stringify(tags));
//client.whisper(chatConfig.channel_owner, new Date().toISOString() + " [RAID] channel=" + channel + ", username=" + username + ",viewers=" + viewers + ", tags=" + JSON.stringify(tags));
client.action(channel, systemMsg); // the tag system-msg is a message generated by the Twitch API which says how many people are raiding and what channel they're coming from, hopefully this works
}

Expand Down
Loading

0 comments on commit 7bbf1f4

Please sign in to comment.