From 989f984cc7aac3283eec78c51121632e9ce5696f Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Thu, 4 May 2023 13:55:58 +0300 Subject: [PATCH] Add group members not currently generating a reply to a stopping strings arrays. #225 --- public/script.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 56b04e1de..3c628bf8f 100644 --- a/public/script.js +++ b/public/script.js @@ -1165,8 +1165,22 @@ function substituteParams(content, _name1, _name2) { function getStoppingStrings(isImpersonate, addSpace) { const charString = `\n${name2}:`; const userString = is_pygmalion ? `\nYou:` : `\n${name1}:`; - const result = isImpersonate ? charString : userString; - return [addSpace ? `${result} ` : result]; + const result = isImpersonate ? [charString] : [userString]; + + // Add other group members as the stopping strings + if (selected_group) { + const group = groups.find(x => x.id === selected_group); + + if (group && Array.isArray(group.members)) { + const names = group.members + .map(x => characters.find(y => y.avatar == x)) + .filter(x => x && x.name !== name2) + .map(x => `\n${x.name}:`); + result.push(...names); + } + } + + return addSpace ? result.map(x => `${result} `) : result; } function processCommands(message, type) {