适配亚服新UID (#364)
This commit is contained in:
parent
7636951048
commit
14e58fc4ed
|
@ -46,7 +46,8 @@ export class gcLog extends plugin {
|
||||||
})
|
})
|
||||||
|
|
||||||
this.androidUrl = "https://docs.qq.com/doc/DUWpYaXlvSklmVXlX"
|
this.androidUrl = "https://docs.qq.com/doc/DUWpYaXlvSklmVXlX"
|
||||||
Object.defineProperty(this, "button", { get() {
|
Object.defineProperty(this, "button", {
|
||||||
|
get() {
|
||||||
this.prefix = this.e?.isSr ? "*" : "#"
|
this.prefix = this.e?.isSr ? "*" : "#"
|
||||||
return segment.button([
|
return segment.button([
|
||||||
{ text: "角色记录", callback: `${this.prefix}角色记录` },
|
{ text: "角色记录", callback: `${this.prefix}角色记录` },
|
||||||
|
@ -58,7 +59,8 @@ export class gcLog extends plugin {
|
||||||
{ text: "常驻记录", callback: `${this.prefix}常驻记录` },
|
{ text: "常驻记录", callback: `${this.prefix}常驻记录` },
|
||||||
{ text: "常驻统计", callback: `${this.prefix}常驻统计` },
|
{ text: "常驻统计", callback: `${this.prefix}常驻统计` },
|
||||||
])
|
])
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
|
@ -73,7 +75,7 @@ export class gcLog extends plugin {
|
||||||
accept() {
|
accept() {
|
||||||
if (this.e.file) {
|
if (this.e.file) {
|
||||||
let name = this.e.file?.name
|
let name = this.e.file?.name
|
||||||
if (/(.*)[1-9][0-9]{8}(.*).json/ig.test(name)) {
|
if (/(.*)([1-9]|18)[0-9]{8}(.*).json/ig.test(name)) {
|
||||||
this.e.msg = "#json文件导入记录"
|
this.e.msg = "#json文件导入记录"
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,13 @@ export class takeBirthdayPhoto extends plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getServer(uid) {
|
async getServer(uid) {
|
||||||
switch (String(uid)[0]) {
|
let uidPrefix = uid.toString()
|
||||||
|
if (uidPrefix.length == 10) {
|
||||||
|
uidPrefix = uidPrefix.slice(0, 2)
|
||||||
|
} else {
|
||||||
|
uidPrefix = uidPrefix.slice(0, 1)
|
||||||
|
}
|
||||||
|
switch (uidPrefix) {
|
||||||
case '1':
|
case '1':
|
||||||
case '2':
|
case '2':
|
||||||
return 'cn_gf01'
|
return 'cn_gf01'
|
||||||
|
@ -107,6 +113,7 @@ export class takeBirthdayPhoto extends plugin {
|
||||||
case '7':
|
case '7':
|
||||||
return 'os_euro'
|
return 'os_euro'
|
||||||
case '8':
|
case '8':
|
||||||
|
case '18':
|
||||||
return 'os_asia'
|
return 'os_asia'
|
||||||
case '9':
|
case '9':
|
||||||
return 'os_cht'
|
return 'os_cht'
|
||||||
|
|
|
@ -42,7 +42,7 @@ export class user extends plugin {
|
||||||
fnc: 'delUid'
|
fnc: 'delUid'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: '^#(原神|星铁)?绑定(uid|UID)?\\s*[1-9][0-9]{8}$',
|
reg: '^#(原神|星铁)?绑定(uid|UID)?\\s*([1-9]|18)[0-9]{8}$',
|
||||||
fnc: 'bingUid'
|
fnc: 'bingUid'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ export class user extends plugin {
|
||||||
/** 绑定uid */
|
/** 绑定uid */
|
||||||
saveUid() {
|
saveUid() {
|
||||||
if (!this.e.msg) return
|
if (!this.e.msg) return
|
||||||
let uid = this.e.msg.match(/[1|2|3|5-9][0-9]{8}/g)
|
let uid = this.e.msg.match(/([1-9]|18)[0-9]{8}/g)
|
||||||
if (!uid) {
|
if (!uid) {
|
||||||
this.reply('uid输入错误', false, { at: true })
|
this.reply('uid输入错误', false, { at: true })
|
||||||
return
|
return
|
||||||
|
|
|
@ -182,7 +182,7 @@ export default class ExportLog extends base {
|
||||||
|
|
||||||
/** json导入抽卡记录 */
|
/** json导入抽卡记录 */
|
||||||
async logJson() {
|
async logJson() {
|
||||||
let uid = /[1-9][0-9]{8}/g.exec(this.e.file.name)[0]
|
let uid = /([1-9]|18)[0-9]{8}/g.exec(this.e.file.name)[0]
|
||||||
let textPath = `${this.path}${this.e.file.name}`
|
let textPath = `${this.path}${this.e.file.name}`
|
||||||
/** 获取文件下载链接 */
|
/** 获取文件下载链接 */
|
||||||
let fileUrl = await this.e.friend.getFileUrl(this.e.file.fid)
|
let fileUrl = await this.e.friend.getFileUrl(this.e.file.fid)
|
||||||
|
|
|
@ -164,7 +164,7 @@ class GsCfg {
|
||||||
}
|
}
|
||||||
|
|
||||||
getMsgUid(msg) {
|
getMsgUid(msg) {
|
||||||
let ret = /[1|2|5-9][0-9]{8}/g.exec(msg)
|
let ret = /([1-9]|18)[0-9]{8}/g.exec(msg)
|
||||||
if (!ret) return false
|
if (!ret) return false
|
||||||
return ret[0]
|
return ret[0]
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ class GsCfg {
|
||||||
* @return uid 游戏uid
|
* @return uid 游戏uid
|
||||||
*/
|
*/
|
||||||
getRole(msg, filterMsg = '', isSr = false) {
|
getRole(msg, filterMsg = '', isSr = false) {
|
||||||
let alias = msg.replace(/#|老婆|老公|[1|2|3|5-9][0-9]{8}/g, '').trim()
|
let alias = msg.replace(/#|老婆|老公|([1-9]|18)[0-9]{8}/g, '').trim()
|
||||||
if (filterMsg) {
|
if (filterMsg) {
|
||||||
alias = alias.replace(new RegExp(filterMsg, 'g'), '').trim()
|
alias = alias.replace(new RegExp(filterMsg, 'g'), '').trim()
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ class GsCfg {
|
||||||
|
|
||||||
// 仅供内部调用
|
// 仅供内部调用
|
||||||
_getRole(msg, filterMsg = '', isSr = false) {
|
_getRole(msg, filterMsg = '', isSr = false) {
|
||||||
let alias = msg.replace(/#|老婆|老公|[1|2|3|5-9][0-9]{8}/g, '').trim()
|
let alias = msg.replace(/#|老婆|老公|([1-9]|18)[0-9]{8}/g, '').trim()
|
||||||
if (filterMsg) {
|
if (filterMsg) {
|
||||||
alias = alias.replace(new RegExp(filterMsg, 'g'), '').trim()
|
alias = alias.replace(new RegExp(filterMsg, 'g'), '').trim()
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,7 +431,7 @@ export default class MysUser extends BaseModel {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
uid = '' + uid
|
uid = '' + uid
|
||||||
if (/\d{9}/.test(uid)) {
|
if (/\d{9,10}/.test(uid)) {
|
||||||
let gameKey = this.gameKey(game)
|
let gameKey = this.gameKey(game)
|
||||||
let uids = this.uids[gameKey]
|
let uids = this.uids[gameKey]
|
||||||
if (!uids.includes(uid)) {
|
if (!uids.includes(uid)) {
|
||||||
|
|
|
@ -50,8 +50,13 @@ export default class MysApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
getServer() {
|
getServer() {
|
||||||
let uid = this.uid
|
let uidPrefix = this.uid.toString()
|
||||||
switch (String(uid)[0]) {
|
if (uidPrefix.length == 10) {
|
||||||
|
uidPrefix = uidPrefix.slice(0, 2)
|
||||||
|
} else {
|
||||||
|
uidPrefix = uidPrefix.slice(0, 1)
|
||||||
|
}
|
||||||
|
switch (uidPrefix) {
|
||||||
case '1':
|
case '1':
|
||||||
case '2':
|
case '2':
|
||||||
return this.isSr ? 'prod_gf_cn' : 'cn_gf01' // 官服
|
return this.isSr ? 'prod_gf_cn' : 'cn_gf01' // 官服
|
||||||
|
@ -62,6 +67,7 @@ export default class MysApi {
|
||||||
case '7':
|
case '7':
|
||||||
return this.isSr ? 'prod_official_euro' : 'os_euro' // 欧服
|
return this.isSr ? 'prod_official_euro' : 'os_euro' // 欧服
|
||||||
case '8':
|
case '8':
|
||||||
|
case '18':
|
||||||
return this.isSr ? 'prod_official_asia' : 'os_asia' // 亚服
|
return this.isSr ? 'prod_official_asia' : 'os_asia' // 亚服
|
||||||
case '9':
|
case '9':
|
||||||
return this.isSr ? 'prod_official_cht' : 'os_cht' // 港澳台服
|
return this.isSr ? 'prod_official_cht' : 'os_cht' // 港澳台服
|
||||||
|
|
|
@ -55,11 +55,18 @@ export default class MysInfo {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!['1', '2', '3', '5', '6', '7', '8', '9'].includes(String(mysInfo.uid)[0])) {
|
let uidPrefix = mysInfo.uid.toString()
|
||||||
|
if (uidPrefix.length == 10) {
|
||||||
|
uidPrefix = uidPrefix.slice(0, 2)
|
||||||
|
} else {
|
||||||
|
uidPrefix = uidPrefix.slice(0, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!['1', '2', '3', '5', '6', '7', '8', '18', '9'].includes(uidPrefix)) {
|
||||||
// e.reply('只支持查询国服uid')
|
// e.reply('只支持查询国服uid')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (!['6', '7', '8', '9'].includes(String(mysInfo.uid)[0]) && api === 'useCdk') {
|
if (!['6', '7', '8', '18', '9'].includes(uidPrefix) && api === 'useCdk') {
|
||||||
e.reply('兑换码使用只支持国际服uid')
|
e.reply('兑换码使用只支持国际服uid')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -103,7 +110,7 @@ export default class MysInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
let matchUid = (msg = '') => {
|
let matchUid = (msg = '') => {
|
||||||
let ret = /[1235-9][0-9]{8}/g.exec(msg)
|
let ret = /([1-9]|18)[0-9]{8}/g.exec(msg)
|
||||||
if (!ret) return false
|
if (!ret) return false
|
||||||
return ret[0]
|
return ret[0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ export default class User extends base {
|
||||||
|
|
||||||
/** 绑定uid,若有ck的话优先使用ck-uid */
|
/** 绑定uid,若有ck的话优先使用ck-uid */
|
||||||
async bingUid() {
|
async bingUid() {
|
||||||
let uid = this.e.msg.match(/[1|2|3|5-9][0-9]{8}/g)
|
let uid = this.e.msg.match(/([1-9]|18)[0-9]{8}/g)
|
||||||
if (!uid) return
|
if (!uid) return
|
||||||
uid = uid[0]
|
uid = uid[0]
|
||||||
let user = await this.user()
|
let user = await this.user()
|
||||||
|
|
Loading…
Reference in New Issue