mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-27 18:01:23 +00:00
Add element filter for ProfileStat.stat (#800)
This commit is contained in:
parent
b157db4b28
commit
3324eaa436
@ -73,7 +73,7 @@ app.reg({
|
||||
name: '面板练度统计',
|
||||
fn: ProfileStat.stat,
|
||||
rule: /^#(星铁|原神)?(面板|喵喵)?练度统计$/,
|
||||
yzRule: /^#*(我的)*(武器|角色|练度|五|四|5|4|星)+(汇总|统计|列表)(force|五|四|5|4|星)*[ |0-9]*$/,
|
||||
yzRule: /^#*(我的)*(风|岩|雷|草|水|火|冰)*(武器|角色|练度|五|四|5|4|星)+(汇总|统计|列表)(force|五|四|5|4|星)*[ |0-9]*$/,
|
||||
yzCheck: () => Cfg.get('profileStat', false)
|
||||
},
|
||||
|
||||
|
@ -78,6 +78,35 @@ const ProfileStat = {
|
||||
avatarRet = lodash.filter(avatarRet, ds => ds.star === starFilter)
|
||||
}
|
||||
|
||||
// elementFilter: 检测是否有元素筛选
|
||||
let elementFilter = []
|
||||
let chineseToEnglishElements = {}
|
||||
if (e.isSr) {
|
||||
// 先给星铁的元素筛选留空
|
||||
} else {
|
||||
chineseToEnglishElements = {
|
||||
'风': 'anemo',
|
||||
'岩': 'geo',
|
||||
'雷': 'electro',
|
||||
'草': 'dendro',
|
||||
'水': 'hydro',
|
||||
'火': 'pyro',
|
||||
'冰': 'cryo'
|
||||
}
|
||||
}
|
||||
for (let [k, v] of Object.entries(chineseToEnglishElements)) {
|
||||
// 如果后续需支持星铁,这里可能也要用到正则判断
|
||||
// e.g. 物(理)? 量(子)? 虚(数)?
|
||||
if (msg.includes(k)) {
|
||||
elementFilter.push(v)
|
||||
}
|
||||
}
|
||||
if (elementFilter.length > 0) {
|
||||
avatarRet = lodash.filter(avatarRet, ds =>
|
||||
elementFilter.some(elem => ds.elem.includes(elem))
|
||||
)
|
||||
}
|
||||
|
||||
let now = moment(new Date())
|
||||
if (now.hour() < 4) {
|
||||
now = now.add(-1, 'days')
|
||||
|
Loading…
Reference in New Issue
Block a user