diff --git a/scripts/defaultConfigs.js b/scripts/defaultConfigs.js index b92f7f1..6a9f56f 100644 --- a/scripts/defaultConfigs.js +++ b/scripts/defaultConfigs.js @@ -2,6 +2,7 @@ const defaultConfigs = (function () { "use strict"; const settings = { + listenAcrossSharedChat: false, replyInChat: true, // true or false enableLimit: false, // true or false limit: 10, // integer diff --git a/scripts/index.js b/scripts/index.js index f1feabb..668ea54 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -26,6 +26,14 @@ function isStreamer(flags) { } ComfyJS.onCommand = (user, command, message, flags, extra) => { + if (!getSetting("listenAcrossSharedChat")) { + // Reject messages from another chat during shared chat if room information + // is present and doesn't match the current chat. + const { roomId, userState } = extra; + const sourceRoomId = userState["source-room-id"]; + if (roomId && sourceRoomId && roomId !== sourceRoomId) return; + } + command = `!${command.toLowerCase()}`; processCommand(user, command, message, flags, extra);