diff --git a/CHANGELOG.md b/CHANGELOG.md index d4077bfe..e0e3da3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ -# 1.2.1 +# 1.2.2 * `#角色面板` 增加伤害计算功能 * 目前支持角色:雷神、胡桃、魈、神子、甘雨、宵宫、公子 +* `#角色面板` 功能升级 + * 优化无角色面板数据时的引导 + * 优化返回的图像格式及分辨率,平衡响应速度及显示效果 +* 添加 `#胡桃面板更新` 命令,获取单个角色面板数据,每天可更新5次 +* 更改 `#全部面板更新` 命令,获取角色展柜全部8个角色,每天可更新3次 + # 1.2.0 diff --git a/apps/character.js b/apps/character.js index 94612cac..b95a4f9e 100644 --- a/apps/character.js +++ b/apps/character.js @@ -65,16 +65,24 @@ export async function character(e, { render, User }) { let mode = 'card'; if (/(详情|详细|面板|面版)$/.test(msg)) { mode = 'profile'; + } else if (/(详情|详细|面板|面版)更新$/.test(msg)) { + mode = "refresh"; } - let name = msg.replace(/#|老婆|老公|详情|详细|面板|面版|[1|2|5][0-9]{8}/g, "").trim(); + let name = msg.replace(/#|老婆|老公|详情|详细|面板|面版|更新|[1|2|5][0-9]{8}/g, "").trim(); let char = Character.get(name); + if (!char) { return false; } + if (mode === "profile") { return renderProfile(e, char, render); + } else if (mode === "refresh") { + e.avatar = char.id; + await getProfile(e); + return true; } else { return renderAvatar(e, char.name, render); } @@ -563,13 +571,17 @@ export async function renderProfile(e, char, render) { cookieType: "self", actionName: "查询角色天赋命座等信息" }); + if (!MysApi) { + return true; + } let selfUser = e.selfUser, uid = selfUser.uid; let profile = Profile.get(uid, char.id); if (!profile) { - e.reply(`请先发送 #获取游戏角色详情 命令获取 ${char.name} 的面板详情。\n请确认已将需要获取的8位角色展示在【游戏内】的“角色展柜”中,并已打开“显示角色详情”。如刚进行设置请等待5分钟后再进行使用,以免浪费请求次数。 `) + e.reply(`请先发送 #${char.name}面板更新\n来获取${char.name}的面板详情`); + e.reply(segment.image(`file://${process.cwd()}/plugins/miao-plugin/resources/character/imgs/help.jpg`)) return true; } diff --git a/components/Profile.js b/components/Profile.js index 6bb2789f..46e9e421 100644 --- a/components/Profile.js +++ b/components/Profile.js @@ -248,8 +248,11 @@ let Profile = { return false; } await redis.set(`miao:role-all:${uid}`, 'loading', { EX: 20 }); - e.reply("开始获取角色展柜中展示的角色详情,数据获取可能会需要一定时间~"); - const api = `${cfg.api}?uid=${uid}&qq=${cfg.qq}&token=${cfg.token}`; + e.reply("开始获取数据,可能会需要一定时间~"); + let api = `${cfg.api}?uid=${uid}&qq=${cfg.qq}&token=${cfg.token}`; + if (e.avatar) { + api += `&avatar=${e.avatar}`; + } let req = await fetch(api); let data = await req.json(); if (data.status !== 0 || !data.data) { diff --git a/index.js b/index.js index bae422d0..a926375b 100644 --- a/index.js +++ b/index.js @@ -25,7 +25,7 @@ export { let rule = { character: { - reg: "^#(喵喵)?(.*)(详情|详细|面板|面版)?$", + reg: "^#(喵喵)?(.*)(详情|详细|面板|面版)?(更新)?$", describe: "【#角色】角色详情", }, wife: { @@ -49,7 +49,7 @@ let rule = { describe: "【#帮助】 #喵喵帮助", }, getProfile: { - reg: "^#(获取|更新)(游戏|角色)*(详情|详细|面板|面版)$", + reg: "^#(全部面板更新|获取游戏角色详情)$", describe: "【#角色】 获取游戏橱窗详情数据", }, enemyLv: { diff --git a/resources/character/imgs/help.jpg b/resources/character/imgs/help.jpg new file mode 100644 index 00000000..f323c25c Binary files /dev/null and b/resources/character/imgs/help.jpg differ