feat: Add support for 'module_enabled' CBS
This commit is contained in:
@@ -86,7 +86,7 @@ const normalCBS = [
|
|||||||
'chat_index', 'first_msg_index', 'blank', 'none', 'message_time', 'message_date', 'time',
|
'chat_index', 'first_msg_index', 'blank', 'none', 'message_time', 'message_date', 'time',
|
||||||
'date', 'isotime', 'isodate', 'message_idle_duration', 'idle_duration', 'br', 'newline',
|
'date', 'isotime', 'isodate', 'message_idle_duration', 'idle_duration', 'br', 'newline',
|
||||||
'model', 'axmodel', 'role', 'jbtoggled', 'random', 'maxcontext', 'lastmessage', 'lastmessageid',
|
'model', 'axmodel', 'role', 'jbtoggled', 'random', 'maxcontext', 'lastmessage', 'lastmessageid',
|
||||||
'lastmessageindex', 'emotionlist', 'assetlist', 'prefill_supported', 'unixtime', '/', '/if', '/each', '/pure', '/if_pure', 'slot'
|
'lastmessageindex', 'emotionlist', 'assetlist', 'prefill_supported', 'unixtime', '/', '/if', '/each', '/pure', '/if_pure', 'slot', 'module_enabled'
|
||||||
]
|
]
|
||||||
|
|
||||||
const normalCBSwithParams = [
|
const normalCBSwithParams = [
|
||||||
|
|||||||
@@ -963,6 +963,18 @@ const matcher = (p1:string,matcherArg:matcherArg) => {
|
|||||||
case 'date_time_format':{
|
case 'date_time_format':{
|
||||||
return dateTimeFormat(arra[1])
|
return dateTimeFormat(arra[1])
|
||||||
}
|
}
|
||||||
|
case 'module_enabled':{
|
||||||
|
const selchar = db.characters[get(selectedCharID)]
|
||||||
|
let enabledChatModules:string[] = []
|
||||||
|
if(!selchar){
|
||||||
|
enabledChatModules = selchar.chats[selchar.chatPage].modules ?? []
|
||||||
|
|
||||||
|
}
|
||||||
|
const moduleId = db.modules.find((f) => {
|
||||||
|
return f.name === arra[1]
|
||||||
|
}).id
|
||||||
|
return (db.enabledModules.includes(moduleId) || enabledChatModules.includes(moduleId)) ? '1' : '0'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(p1.startsWith('random')){
|
if(p1.startsWith('random')){
|
||||||
|
|||||||
Reference in New Issue
Block a user