Lazy evaluation of macro in first message

This commit is contained in:
Cohee 2024-03-15 11:39:21 +02:00
parent 54d5e269d5
commit a12793a9ac
1 changed files with 6 additions and 2 deletions

View File

@ -1629,6 +1629,10 @@ function messageFormatting(mes, ch_name, isSystem, isUser, messageId) {
return '';
}
if (Number(messageId) === 0 && !isSystem && !isUser) {
mes = substituteParams(mes);
}
mesForShowdownParse = mes;
// Force isSystem = false on comment messages so they get formatted properly
@ -5360,12 +5364,12 @@ function getFirstMessage() {
is_user: false,
is_system: false,
send_date: getMessageTimeStamp(),
mes: substituteParams(getRegexedString(firstMes, regex_placement.AI_OUTPUT)),
mes: getRegexedString(firstMes, regex_placement.AI_OUTPUT),
extra: {},
};
if (Array.isArray(alternateGreetings) && alternateGreetings.length > 0) {
const swipes = [message.mes, ...(alternateGreetings.map(greeting => substituteParams(getRegexedString(greeting, regex_placement.AI_OUTPUT))))];
const swipes = [message.mes, ...(alternateGreetings.map(greeting => getRegexedString(greeting, regex_placement.AI_OUTPUT)))];
message['swipe_id'] = 0;
message['swipes'] = swipes;
message['swipe_info'] = [];