diff --git a/apps/profile.js b/apps/profile.js index f7612c38..5e80a85f 100644 --- a/apps/profile.js +++ b/apps/profile.js @@ -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) }, diff --git a/apps/profile/ProfileStat.js b/apps/profile/ProfileStat.js index b82920e0..6db3f2c7 100644 --- a/apps/profile/ProfileStat.js +++ b/apps/profile/ProfileStat.js @@ -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')