Extend case for chat index and role (#577)

# PR Checklist
- [ ] Did you check if it works normally in all models? *ignore this
when it dosen't uses models*
- [ ] Did you check if it works normally in all of web, local and node
hosted versions? if it dosen't, did you blocked it in those versions?
- [ ] Did you added a type def?

# Description
With the recent increased utilization of custom styles, I've modified
the '{{chat_index}}' and '{{roll}}' cbs to cover a bit more cases.
Please review them to see if they meet your vision.


![image](https://github.com/user-attachments/assets/86ddb894-a497-4b60-b7b6-8c5040b276fb)
This commit is contained in:
kwaroran
2024-07-18 12:30:54 +09:00
committed by GitHub
2 changed files with 5 additions and 1 deletions

View File

@@ -926,6 +926,10 @@ function basicMatcher (p1:string,matcherArg:matcherArg,vars:{[key:string]:string
return db.subModel
}
case 'role': {
if (chatID !== -1) {
const selchar = db.characters[get(selectedCharID)]
return selchar.chats[selchar.chatPage].message[chatID].role;
}
return matcherArg.role ?? 'role'
}
case 'jbtoggled':{

View File

@@ -197,7 +197,7 @@ export async function processScriptFull(char:character|groupChat|simpleCharacter
}
}
else{
data = risuChatParser(data.replace(reg, outScript))
data = risuChatParser(data.replace(reg, outScript), { chatID: chatID })
}
}
}