fix: note

This commit is contained in:
bietiaop 2024-07-08 17:01:24 +08:00
parent 8f5e986038
commit f0ef2bd624
4 changed files with 68 additions and 12 deletions

View file

@ -33,17 +33,17 @@ export default class MysZZZApi extends MysApi {
getServer() {
const _uid = this.uid.toString();
if (_uid.length < 10) {
return game_region[this.game][0]; // 官服
return game_region[0]; // 官服
}
switch (_uid.slice(0, -8)) {
case '10':
return game_region[this.game][2]; // 美服
return game_region[2]; // 美服
case '15':
return game_region[this.game][3]; // 欧服
return game_region[3]; // 欧服
case '13':
return game_region[this.game][4]; // 亚服
return game_region[4]; // 亚服
case '17':
return game_region[this.game][5]; // 港澳台服
return game_region[5]; // 港澳台服
}
}

View file

@ -4,20 +4,24 @@ import _ from 'lodash';
import NoteUser from '../../genshin/model/mys/NoteUser.js';
export class ZZZPlugin extends plugin {
async getAPI() {
async getUID() {
let user = this.e;
if (this.e.at) {
user = this.e.at;
}
this.User = await NoteUser.create(user);
logger.mark(this.User);
logger.mark(this.User.getUid('zzz'));
let uid = this.e.msg.match(/\d+/)?.[0];
uid = uid || this.User?.getUid('zzz');
if (!uid) {
await this.reply('uid为空米游社查询请先绑定cookie其他查询请携带uid');
return false;
}
return uid;
}
async getAPI() {
uid = await this.getUID();
if (!uid) return false;
const ck = await getCk(this.e);
if (!ck || Object.keys(ck).filter(k => ck[k].ck).length === 0) {
await this.reply('尚未绑定cookie请先绑定cookie');