[feat] regex flags, fix display
This commit is contained in:
@@ -63,7 +63,6 @@ export function groupOrder(chars:GroupOrder[], input:string):GroupOrder[] {
|
||||
for (const word of words) {
|
||||
for (let char of chars) {
|
||||
const charNameChunks = getWords(findCharacterbyId(char.id).name)
|
||||
console.log(charNameChunks)
|
||||
|
||||
if (charNameChunks.includes(word)) {
|
||||
order.push(char);
|
||||
@@ -96,8 +95,11 @@ export function groupOrder(chars:GroupOrder[], input:string):GroupOrder[] {
|
||||
}
|
||||
|
||||
function getWords(data:string){
|
||||
const matches = data.match(/\b\w+\b/gmi)
|
||||
const matches = data.split(/\n| /g)
|
||||
let words:string[] = []
|
||||
if(!matches){
|
||||
return [data]
|
||||
}
|
||||
for(const match of matches){
|
||||
words.push(match.toLocaleLowerCase())
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export function processScriptFull(char:character|groupChat, data:string, mode:Sc
|
||||
const scripts = (db.globalscript ?? []).concat(char.customscript)
|
||||
for (const script of scripts){
|
||||
if(script.type === mode){
|
||||
const reg = new RegExp(script.in,'g')
|
||||
const reg = new RegExp(script.in, script.ableFlag ? script.flag : 'g')
|
||||
const outScript = script.out
|
||||
if(outScript.startsWith('@@') && reg.test(data)){
|
||||
if(outScript.startsWith('@@emo ')){
|
||||
|
||||
Reference in New Issue
Block a user