From fede942a799f37862f95424c34593c0428d79c2f Mon Sep 17 00:00:00 2001 From: bbaban <3102509561@qq.com> Date: Wed, 20 Sep 2023 20:09:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=9F=E9=93=81=E6=8A=BD=E5=8D=A1=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E8=87=AA=E5=8A=A8=E8=A1=A5=E5=85=A8region=EF=BC=8C?= =?UTF-8?q?=E9=80=82=E9=85=8D=E5=AE=89=E5=8D=93=E5=8F=A6=E4=B8=80=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E7=9A=84=E6=98=9F=E9=93=81=E6=8A=BD=E5=8D=A1=E9=93=BE?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugins/loader.js | 2 +- plugins/genshin/model/gachaLog.js | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/plugins/loader.js b/lib/plugins/loader.js index 83ebb71..9953e4b 100644 --- a/lib/plugins/loader.js +++ b/lib/plugins/loader.js @@ -220,7 +220,7 @@ class PluginsLoader { // 判断是否是星铁命令,若是星铁命令则标准化处理 // e.isSr = true,且命令标准化为 #星铁 开头 - if (this.srReg.test(e.msg) || /\/common\//.test(e.msg)) { + if (this.srReg.test(e.msg) || /(\/common\/|hkrpg)/.test(e.msg)) { e.isSr = true e.msg = e.msg.replace(this.srReg, '#星铁') } diff --git a/plugins/genshin/model/gachaLog.js b/plugins/genshin/model/gachaLog.js index 98eea29..4c9d412 100644 --- a/plugins/genshin/model/gachaLog.js +++ b/plugins/genshin/model/gachaLog.js @@ -90,6 +90,7 @@ export default class GachaLog extends base { // timestamp=1641338980〈=zh-cn 修复链接有奇怪符号 url = url.replace(/〈=/g, '&') if (url.includes('getGachaLog?')) url = url.split('getGachaLog?')[1] + if (url.includes('index.html?')) url = url.split('index.html?')[1] // 处理参数 let arr = new URLSearchParams(url).entries() @@ -141,8 +142,25 @@ export default class GachaLog extends base { async checkUrl (param) { if (!param.region) { - this.e.reply('链接参数错误:缺少region\n请复制完整链接') - return false + let res = await this.logApi({ + size: 6, + authkey: param.authkey, + region: this.e.isSr ? 'prod_gf_cn' : 'cn_gf01' + }) + if (!res?.data?.region) { + res = await this.logApi({ + size: 6, + authkey: param.authkey, + region: this.e.isSr ? 'prod_official_usa' : 'os_usa' + }) + } + + if (res?.data?.region) { + param.region = res?.data?.region + } else { + await this.e.reply('链接复制错误或已失效') + return false + } } let res = await this.logApi({