fix:私聊通行字符串设为null或空数组时禁用私聊失效 fixed #371 (#372)

This commit is contained in:
zolay 2024-02-19 03:08:47 +08:00 committed by GitHub
parent 259797ed15
commit c86986edfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -29,9 +29,14 @@ export class disPri extends plugin {
/** 绑定ck抽卡链接 */
let wordReg = /(.*)(ltoken|_MHYUUID|authkey=)(.*)|导出记录(json)*|(记录|安卓|苹果|ck|cookie|体力)帮助|^帮助$|^#*(删除|我的)ck$|^#(我的)?(uid|UID)[0-9]{0,2}$/g
/** 自定义通行字符 */
let disableReg = `(.*)(${cfg.other?.disableAdopt?.join('|')})(.*)`
let disableAdopt = cfg.other?.disableAdopt
if (!Array.isArray(disableAdopt)) {
disableAdopt = []
}
disableAdopt = disableAdopt.filter(str => str != null && str !== '');
let disableReg = `(.*)(${disableAdopt.join('|')})(.*)`
if (this.e.raw_message) {
if (!new RegExp(wordReg).test(this.e.raw_message) && (!new RegExp(disableReg).test(this.e.raw_message))) {
if (!new RegExp(wordReg).test(this.e.raw_message) && (disableAdopt.length === 0 || !new RegExp(disableReg).test(this.e.raw_message))) {
this.sendTips()
return 'return'
}