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

@ -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');