Skip to content
Merged
21 changes: 10 additions & 11 deletions src/backend/chat/chat-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ class FirebotChatHelpers {
return parts.flatMap((p) => {
if (p.type === "text" && p.text != null) {

if (firebotChatMessage.username !== streamer.displayName &&
(!bot.loggedIn || firebotChatMessage.username !== bot.displayName)) {
if (firebotChatMessage.username !== streamer.username &&
(!bot.loggedIn || firebotChatMessage.username !== bot.username)) {
if (!firebotChatMessage.whisper &&
!firebotChatMessage.tagged &&
streamer.loggedIn &&
Expand Down Expand Up @@ -346,9 +346,8 @@ class FirebotChatHelpers {
buildBasicFirebotChatMessage(msgText: string, username: string): FirebotChatMessage {
return {
id: null,
userIdName: null,
userId: null,
username: username,
userId: null,
rawText: msgText,
whisper: false,
action: false,
Expand All @@ -362,9 +361,9 @@ class FirebotChatHelpers {
async buildFirebotChatMessage(msg: ChatMessage, msgText: string, whisper = false, action = false) {
const firebotChatMessage: FirebotChatMessage = {
id: msg.tags.get("id"),
username: msg.userInfo.displayName,
userIdName: msg.userInfo.userName,
username: msg.userInfo.userName,
userId: msg.userInfo.userId,
userDisplayName: msg.userInfo.displayName,
customRewardId: msg.tags.get("custom-reward-id") || undefined,
isHighlighted: msg.tags.get("msg-id") === "highlighted-message",
isAnnouncement: false,
Expand Down Expand Up @@ -442,12 +441,12 @@ class FirebotChatHelpers {
firebotChatMessage.isSubscriber = msg.userInfo.isSubscriber;
firebotChatMessage.isVip = msg.userInfo.isVip;

if (streamer.loggedIn && firebotChatMessage.username === streamer.displayName) {
if (streamer.loggedIn && firebotChatMessage.username === streamer.username) {
firebotChatMessage.isBroadcaster = true;
firebotChatMessage.roles.push("broadcaster");
}

if (bot.loggedIn && firebotChatMessage.username === bot.displayName) {
if (bot.loggedIn && firebotChatMessage.username === bot.username) {
firebotChatMessage.isBot = true;
firebotChatMessage.roles.push("bot");
}
Expand Down Expand Up @@ -478,8 +477,8 @@ class FirebotChatHelpers {
const firebotChatMessage: FirebotChatMessage = {
id: id,
username: extensionName,
userIdName: extensionName,
userId: extensionName,
userDisplayName: extensionName,
rawText: text,
profilePicUrl: extensionIconUrl,
whisper: false,
Expand Down Expand Up @@ -513,9 +512,9 @@ class FirebotChatHelpers {

const viewerFirebotChatMessage: FirebotChatMessage = {
id: msg.messageId,
username: msg.senderDisplayName,
userIdName: msg.senderName,
username: msg.senderName,
userId: msg.senderId,
userDisplayName: msg.senderDisplayName,
rawText: msg.messageContent,
profilePicUrl: profilePicUrl,
whisper: false,
Expand Down
17 changes: 10 additions & 7 deletions src/backend/chat/chat-listeners/twitch-chat-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ exports.setupChatListeners = (streamerChatClient, botChatClient) => {
frontendCommunicator.send("twitch:chat:message", firebotChatMessage);

twitchEventsHandler.announcement.triggerAnnouncement(
firebotChatMessage.userIdName,
firebotChatMessage.userId,
firebotChatMessage.username,
firebotChatMessage.userId,
firebotChatMessage.userDisplayName,
firebotChatMessage.roles,
firebotChatMessage.rawText
);
Expand Down Expand Up @@ -71,7 +71,8 @@ exports.setupChatListeners = (streamerChatClient, botChatClient) => {
messageText: firebotChatMessage.rawText,
user: {
id: firebotChatMessage.userId,
username: firebotChatMessage.username
username: firebotChatMessage.username,
displayName: firebotChatMessage.userDisplayName
},
reward: {
id: HIGHLIGHT_MESSAGE_REWARD_ID,
Expand All @@ -89,9 +90,9 @@ exports.setupChatListeners = (streamerChatClient, botChatClient) => {
await activeUserHandler.addActiveUser(msg.userInfo, true);

twitchEventsHandler.viewerArrived.triggerViewerArrived(
msg.userInfo.displayName,
msg.userInfo.userName,
msg.userInfo.userId,
msg.userInfo.displayName,
messageText,
firebotChatMessage
);
Expand All @@ -118,6 +119,8 @@ exports.setupChatListeners = (streamerChatClient, botChatClient) => {

twitchEventsHandler.whisper.triggerWhisper(
msg.userInfo.userName,
msg.userInfo.userId,
msg.userInfo.displayName,
messageText,
accountType
);
Expand Down Expand Up @@ -149,9 +152,9 @@ exports.setupChatListeners = (streamerChatClient, botChatClient) => {
}

twitchEventsHandler.viewerArrived.triggerViewerArrived(
msg.userInfo.displayName,
msg.userInfo.userName,
msg.userInfo.userId,
msg.userInfo.displayName,
messageText,
firebotChatMessage
);
Expand Down Expand Up @@ -218,8 +221,8 @@ exports.setupChatListeners = (streamerChatClient, botChatClient) => {
streamerChatClient.onGiftPaidUpgrade((_channel, _user, subInfo, msg) => {
twitchEventsHandler.giftSub.triggerSubGiftUpgrade(
msg.userInfo.userName,
subInfo.displayName,
subInfo.userId,
subInfo.displayName,
subInfo.gifterDisplayName,
subInfo.plan
);
Expand All @@ -228,8 +231,8 @@ exports.setupChatListeners = (streamerChatClient, botChatClient) => {
streamerChatClient.onPrimePaidUpgrade((_channel, _user, subInfo, msg) => {
twitchEventsHandler.sub.triggerPrimeUpgrade(
msg.userInfo.userName,
subInfo.displayName,
subInfo.userId,
subInfo.displayName,
subInfo.plan
);
});
Expand Down
1 change: 1 addition & 0 deletions src/backend/chat/commands/chat-command-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class CommandHandler {
metadata: {
username: commandSender,
userId: firebotChatMessage.userId,
userDisplayName: firebotChatMessage.userDisplayName,
userTwitchRoles: firebotChatMessage.roles,
command: command,
userCommand: userCmd,
Expand Down
4 changes: 2 additions & 2 deletions src/backend/chat/commands/command-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class CommandRunner {
metadata: {
username: userCommand.commandSender,
userId: undefined,
userIdName: undefined,
userDisplayName: userCommand.commandSender,
command: command,
userCommand: userCommand,
chatMessage: firebotChatMessage
Expand All @@ -128,7 +128,7 @@ class CommandRunner {

if (firebotChatMessage != null) {
processEffectsRequest.trigger.metadata.userId = firebotChatMessage.userId;
processEffectsRequest.trigger.metadata.userIdName = firebotChatMessage.userIdName;
processEffectsRequest.trigger.metadata.userDisplayName = firebotChatMessage.userDisplayName;
}

return effectRunner.processEffects(processEffectsRequest).catch((reason) => {
Expand Down
Loading