Add {{groupNotMuted}}

3502bfcaa0aed1c00150f45e21e41e885241caa6

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +9 -4Ignore whitespace
public/script.js+7 -3
@@ -2607,15 +2607,18 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
26072607 };
26082608 }
26092609
26102610 const getGroupValue = (includeMuted) => {
26112611 if (typeof _group === 'string') {
26122612 return _group;
26132613 }
26142614
26152615 if (selected_group) {
26162616 const members = groups.find(x => x.id === selected_group)?.members;
2617+ /** @type {string[]} */
2618+ const disabledMembers = groups.find(x => x.id === selected_group)?.disabled_members ?? [];
2619+ const isMuted = x => includeMuted ? true : !disabledMembers.includes(x);
26172620 const names = Array.isArray(members)
26182621 ? members.filter(isMuted).map(m => characters.find(c => c.avatar === m)?.name).filter(Boolean).join(', ')
26192622 : '';
26202623 return names;
26212624 } else {
@@ -2639,7 +2642,8 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
26392642 // Must be substituted last so that they're replaced inside {{description}}
26402643 environment.user = _name1 ?? name1;
26412644 environment.char = _name2 ?? name2;
26422645 environment.group = environment.charIfNotGroup = getGroupValue(true);
2646+ environment.groupNotMuted = getGroupValue(false);
26432647 environment.model = getGeneratingModel();
26442648
26452649 if (additionalMacro && typeof additionalMacro === 'object') {
public/scripts/templates/macros.html+2 -1
@@ -21,7 +21,8 @@
2121 <li><tt>&lcub;&lcub;user&rcub;&rcub;</tt> – <span data-i18n="help_macros_15">your current Persona username</span></li>
2222 <li><tt>&lcub;&lcub;char&rcub;&rcub;</tt> – <span data-i18n="help_macros_16">the Character's name</span></li>
2323 <li><tt>&lcub;&lcub;char_version&rcub;&rcub;</tt> – <span data-i18n="help_macros_17">the Character's version number</span></li>
2424 <li><tt>&lcub;&lcub;group&rcub;&rcub;</tt> – <span data-i18n="help_macros_18">a comma-separated list of group member names (including muted) or the character name in solo chats. Alias: &lcub;&lcub;charIfNotGroup&rcub;&rcub;</span></li>
25+ <li><tt>&lcub;&lcub;groupNotMuted&rcub;&rcub;</tt> – <span data-i18n="help_groupNotMuted">the same as &lcub;&lcub;group&rcub;&rcub;, but excludes muted members</span></li>
2526 <li><tt>&lcub;&lcub;model&rcub;&rcub;</tt> – <span data-i18n="help_macros_19">a text generation model name for the currently selected API. </span><b data-i18n="Can be inaccurate!">Can be inaccurate!</b></li>
2627 <li><tt>&lcub;&lcub;lastMessage&rcub;&rcub;</tt> – <span data-i18n="help_macros_20">the text of the latest chat message.</span></li>
2728 <li><tt>&lcub;&lcub;lastUserMessage&rcub;&rcub;</tt> – <span data-i18n="help_macros_lastUser">the text of the latest user chat message.</span></li>