From 647fc49a52d33be8a5c51329d925bc22f6fcb8fa Mon Sep 17 00:00:00 2001 From: kaguramaisakuya <1657974606@qq.com> Date: Sun, 4 Feb 2024 10:04:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9E=E9=94=81=E5=8F=8D=E5=BA=94=E7=9C=9F?= =?UTF-8?q?=E5=8F=AF=E6=80=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/profile.js | 14 ++++++------ apps/profile/ProfileChange.js | 42 +++++++++++++++++------------------ apps/profile/ProfileCommon.js | 8 +++---- apps/profile/ProfileList.js | 10 ++++----- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/apps/profile.js b/apps/profile.js index 42c41ad4..cd80b1b2 100644 --- a/apps/profile.js +++ b/apps/profile.js @@ -18,13 +18,13 @@ app.reg({ name: '面板角色列表', desc: '查看当前已获取面板数据的角色列表', fn: ProfileList.render, - rule: /^#(星铁|原神)?(面板角色|角色面板|面板)(列表)?\s*(\d{9})?$/ + rule: /^#(星铁|原神)?(面板角色|角色面板|面板)(列表)?\s*(\d{9,10})?$/ }, profileDetail: { name: '角色面板', fn: ProfileDetail.detail, - rule: /^#*([^#]+)\s*(详细|详情|面板|面版|圣遗物|武器[1-7]?|伤害([1-9]+\d*)?)\s*(\d{9})*(.*[换变改].*)?$/ + rule: /^#*([^#]+)\s*(详细|详情|面板|面版|圣遗物|武器[1-7]?|伤害([1-9]+\d*)?)\s*(\d{9,10})*(.*[换变改].*)?$/ }, profileChange: { @@ -66,7 +66,7 @@ app.reg({ artisList: { name: '面板圣遗物列表', fn: profileArtisList, - rule: /^#圣遗物列表\s*(\d{9})?$/ + rule: /^#圣遗物列表\s*(\d{9,10})?$/ }, profileStat: { @@ -87,7 +87,7 @@ app.reg({ name: '角色查询', fn: ProfileStat.avatarList, rule: /^#喵喵(角色|查询)[ |0-9]*$/, - yzRule: /^(#(五|四|5|4|星)*(角色|查询|查询角色|角色查询|人物)[ |0-9]*$)|(^(#*uid|#*UID)\+*[1|2|5-9][0-9]{8}$)|(^#[\+|+]*[1|2|5-9][0-9]{8})/, + yzRule: /^(#(五|四|5|4|星)*(角色|查询|查询角色|角色查询|人物)[ |0-9]*$)|(^(#*uid|#*UID)\+*([1-9]|18)[0-9]{8}$)|(^#[\+|+]*([1-9]|18)[0-9]{8})/, yzCheck: () => Cfg.get('avatarList', false) }, @@ -114,7 +114,7 @@ app.reg({ name: '面板更新', describe: '【#角色】 获取游戏橱窗详情数据', fn: ProfileList.refresh, - rule: /^#(星铁|原神)?(全部面板更新|更新全部面板|获取游戏角色详情|更新面板|面板更新)\s*(\d{9})?$/ + rule: /^#(星铁|原神)?(全部面板更新|更新全部面板|获取游戏角色详情|更新面板|面板更新)\s*(\d{9,10})?$/ }, uploadImg: { @@ -142,13 +142,13 @@ app.reg({ name: '删除面板', describe: '【#角色】 删除游戏橱窗详情数据', fn: ProfileList.del, - rule: /^#(删除全部面板|删除面板|删除面板数据)\s*(\d{9})?$/ + rule: /^#(删除全部面板|删除面板|删除面板数据)\s*(\d{9,10})?$/ }, profileReload: { name: '重新加载面板', fn: ProfileList.reload, - rule: /^#(星铁|原神)?(加载|重新加载|重载)面板\s*(\d{9})?$/ + rule: /^#(星铁|原神)?(加载|重新加载|重载)面板\s*(\d{9,10})?$/ } }) diff --git a/apps/profile/ProfileChange.js b/apps/profile/ProfileChange.js index 30f0761d..eccec22e 100644 --- a/apps/profile/ProfileChange.js +++ b/apps/profile/ProfileChange.js @@ -20,12 +20,12 @@ const ProfileChange = { * @param msg * @returns {{}} */ - matchMsg (msg) { + matchMsg(msg) { if (!/(变|改|换)/.test(msg)) { return false } msg = msg.toLowerCase().replace(/uid ?:? ?/, '').replace('', '') - let regRet = /^#*(\d{9})?(.+?)(详细|详情|面板|面版|圣遗物|伤害[1-7]?)?\s*(\d{9})?[变换改](.+)/.exec(msg) + let regRet = /^#*(\d{9,10})?(.+?)(详细|详情|面板|面版|圣遗物|伤害[1-7]?)?\s*(\d{9,10})?[变换改](.+)/.exec(msg) if (!regRet || !regRet[2]) { return false } @@ -39,31 +39,31 @@ const ProfileChange = { const isGs = game === 'gs' const keyMap = isGs ? { - artis: '圣遗物', - arti1: '花,生之花', - arti2: '毛,羽,羽毛,死之羽', - arti3: '沙,沙漏,表,时之沙', - arti4: '杯,杯子,空之杯', - arti5: '头,冠,理之冠,礼冠,帽子,帽', - weapon: '武器' - } + artis: '圣遗物', + arti1: '花,生之花', + arti2: '毛,羽,羽毛,死之羽', + arti3: '沙,沙漏,表,时之沙', + arti4: '杯,杯子,空之杯', + arti5: '头,冠,理之冠,礼冠,帽子,帽', + weapon: '武器' + } : { - artis: '圣遗物,遗器', - arti1: '头,帽子,头部', - arti2: '手,手套,手部', - arti3: '衣,衣服,甲,躯干,', - arti4: '鞋,靴,鞋子,靴子,脚,脚部', - arti5: '球,位面球', - arti6: '绳,线,链接绳,连接绳', - weapon: '武器,光锥' - } + artis: '圣遗物,遗器', + arti1: '头,帽子,头部', + arti2: '手,手套,手部', + arti3: '衣,衣服,甲,躯干,', + arti4: '鞋,靴,鞋子,靴子,脚,脚部', + arti5: '球,位面球', + arti6: '绳,线,链接绳,连接绳', + weapon: '武器,光锥' + } let keyTitleMap = {} lodash.forEach(keyMap, (val, key) => { lodash.forEach(val.split(','), (v) => { keyTitleMap[v] = key }) }) - const keyReg = new RegExp(`^(\\d{9})?\\s*(.+?)\\s*(\\d{9})?\\s*((?:${lodash.keys(keyTitleMap).join('|')}|\\+)+)$`) + const keyReg = new RegExp(`^(\\d{9,10})?\\s*(.+?)\\s*(\\d{9,10})?\\s*((?:${lodash.keys(keyTitleMap).join('|')}|\\+)+)$`) ret.char = char.id ret.mode = regRet[3] === '换' ? '面板' : regRet[3] @@ -197,7 +197,7 @@ const ProfileChange = { * @param game * @returns {Avatar|boolean} */ - getProfile (uid, charid, ds, game = 'gs') { + getProfile(uid, charid, ds, game = 'gs') { if (!charid) { return false } diff --git a/apps/profile/ProfileCommon.js b/apps/profile/ProfileCommon.js index d8fac8c9..492cf286 100644 --- a/apps/profile/ProfileCommon.js +++ b/apps/profile/ProfileCommon.js @@ -8,7 +8,7 @@ import { Button, Character, MysApi, Player } from '#miao.models' * 获取面板查询的 目标uid * */ const _getTargetUid = async function (e) { - let uidReg = /[1-9][0-9]{8}/ + let uidReg = /([1-9]|18)[0-9]{8}/ if (e.uid && uidReg.test(e.uid)) { return e.uid @@ -38,7 +38,7 @@ const _getTargetUid = async function (e) { return uid || false } -export async function getTargetUid (e) { +export async function getTargetUid(e) { let uid = await _getTargetUid(e) if (uid) { e.uid = uid @@ -46,7 +46,7 @@ export async function getTargetUid (e) { return uid } -export async function getProfileRefresh (e, avatar) { +export async function getProfileRefresh(e, avatar) { let char = Character.get(avatar) if (!char) { return false @@ -71,7 +71,7 @@ export async function getProfileRefresh (e, avatar) { /* * 面板帮助 * */ -export async function profileHelp (e) { +export async function profileHelp(e) { e.reply(segment.image(`file://${process.cwd()}/plugins/miao-plugin/resources/character/imgs/help.jpg`)) return true } diff --git a/apps/profile/ProfileList.js b/apps/profile/ProfileList.js index 420103a1..b6d3ec77 100644 --- a/apps/profile/ProfileList.js +++ b/apps/profile/ProfileList.js @@ -9,7 +9,7 @@ const ProfileList = { * @param e * @returns {Promise} */ - async refresh (e) { + async refresh(e) { let uid = await getTargetUid(e) if (!uid) { e._replyNeedUid || e.reply(['请先发送【#绑定+你的UID】来绑定查询目标\n星铁请使用【#星铁绑定+UID】', new Button(e).bindUid()]) @@ -48,7 +48,7 @@ const ProfileList = { * @returns {Promise} */ - async render (e) { + async render(e) { let uid = await getTargetUid(e) if (!uid) { e._replyNeedUid || e.reply(['请先发送【#绑定+你的UID】来绑定查询目标\n星铁请使用【#星铁绑定+UID】', new Button(e).bindUid()]) @@ -149,8 +149,8 @@ const ProfileList = { * @param e * @returns {Promise} */ - async del (e) { - let ret = /^#(删除全部面板|删除面板|删除面板数据)\s*(\d{9})?$/.exec(e.msg) + async del(e) { + let ret = /^#(删除全部面板|删除面板|删除面板数据)\s*(\d{9,10})?$/.exec(e.msg) let uid = await getTargetUid(e) if (!uid) { return true @@ -179,7 +179,7 @@ const ProfileList = { return true }, - async reload (e) { + async reload(e) { let uid = await getTargetUid(e) if (!uid) { return true