Add new cbs to the parser.ts file

This commit is contained in:
kwaroran
2024-04-03 19:36:27 +09:00
parent 8f8441e529
commit 1c3c3cc16d

View File

@@ -405,7 +405,8 @@ const matcher = (p1:string,matcherArg:matcherArg) => {
const db = matcherArg.db
const chara = matcherArg.chara
switch(lowerCased){
case 'previous_char_chat':{
case 'previous_char_chat':
case 'lastusermessage':{
if(chatID !== -1){
const selchar = db.characters[get(selectedCharID)]
const chat = selchar.chats[selchar.chatPage]
@@ -420,7 +421,8 @@ const matcher = (p1:string,matcherArg:matcherArg) => {
}
return ''
}
case 'previous_user_chat':{
case 'previous_user_chat':
case 'lastcharmessage':{
if(chatID !== -1){
const selchar = db.characters[get(selectedCharID)]
const chat = selchar.chats[selchar.chatPage]
@@ -625,7 +627,8 @@ const matcher = (p1:string,matcherArg:matcherArg) => {
//output, like 1:30:00
return hours.toString() + ':' + minutes.toString().padStart(2,'0') + ':' + seconds.toString().padStart(2,'0')
}
case 'br':{
case 'br':
case 'newline':{
return '\n'
}
case 'model':{
@@ -643,6 +646,26 @@ const matcher = (p1:string,matcherArg:matcherArg) => {
case 'random':{
return Math.random().toString()
}
case 'maxcontext':{
return db.maxContext.toString()
}
case 'lastmessage':{
const selchar = db.characters[get(selectedCharID)]
if(!selchar){
return ''
}
const chat = selchar.chats[selchar.chatPage]
return chat.message[chat.message.length - 1].data
}
case 'lastmessageid':
case 'lastmessageindex':{
const selchar = db.characters[get(selectedCharID)]
if(!selchar){
return ''
}
const chat = selchar.chats[selchar.chatPage]
return chat.message.length - 1
}
}
const arra = p1.split("::")
if(arra.length > 1){