fixed shared chat bug

This commit is contained in:
liyunze 2026-01-06 20:36:37 +08:00
parent 8a3bf1defe
commit 3c9b8f4bc9
2 changed files with 9 additions and 0 deletions

View file

@ -2,6 +2,7 @@ const defaultConfigs = (function () {
"use strict"; "use strict";
const settings = { const settings = {
listenAcrossSharedChat: false,
replyInChat: true, // true or false replyInChat: true, // true or false
enableLimit: false, // true or false enableLimit: false, // true or false
limit: 10, // integer limit: 10, // integer

View file

@ -26,6 +26,14 @@ function isStreamer(flags) {
} }
ComfyJS.onCommand = (user, command, message, flags, extra) => { 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()}`; command = `!${command.toLowerCase()}`;
processCommand(user, command, message, flags, extra); processCommand(user, command, message, flags, extra);