!111 星铁抽卡记录自动补全region,适配安卓另一格式的星铁抽卡链接

Merge pull request !111 from 帮帮/master
This commit is contained in:
Kokomi 2023-09-21 18:23:17 +00:00 committed by Gitee
commit 197db1654f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 21 additions and 3 deletions

View File

@ -220,7 +220,7 @@ class PluginsLoader {
// 判断是否是星铁命令,若是星铁命令则标准化处理 // 判断是否是星铁命令,若是星铁命令则标准化处理
// e.isSr = true且命令标准化为 #星铁 开头 // 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.isSr = true
e.msg = e.msg.replace(this.srReg, '#星铁') e.msg = e.msg.replace(this.srReg, '#星铁')
} }

View File

@ -90,6 +90,7 @@ export default class GachaLog extends base {
// timestamp=1641338980〈=zh-cn 修复链接有奇怪符号 // timestamp=1641338980〈=zh-cn 修复链接有奇怪符号
url = url.replace(/〈=/g, '&') url = url.replace(/〈=/g, '&')
if (url.includes('getGachaLog?')) url = url.split('getGachaLog?')[1] 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() let arr = new URLSearchParams(url).entries()
@ -141,8 +142,25 @@ export default class GachaLog extends base {
async checkUrl (param) { async checkUrl (param) {
if (!param.region) { if (!param.region) {
this.e.reply('链接参数错误缺少region\n请复制完整链接') let res = await this.logApi({
return false 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({ let res = await this.logApi({