diff --git a/src/ts/gui/highlight.ts b/src/ts/gui/highlight.ts index 14e0c2b4..110c72ad 100644 --- a/src/ts/gui/highlight.ts +++ b/src/ts/gui/highlight.ts @@ -86,7 +86,7 @@ const normalCBS = [ 'chat_index', 'first_msg_index', 'blank', 'none', 'message_time', 'message_date', 'time', 'date', 'isotime', 'isodate', 'message_idle_duration', 'idle_duration', 'br', 'newline', '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 = [ diff --git a/src/ts/parser.ts b/src/ts/parser.ts index 665beaf5..5ea9747b 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -963,6 +963,18 @@ const matcher = (p1:string,matcherArg:matcherArg) => { case 'date_time_format':{ 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')){