refactor: 重构lib代码(无实质性功能更新,可不更新)

This commit is contained in:
bietiaop 2024-08-22 13:34:08 +08:00
parent a7f06d404b
commit aa3b7928ec
26 changed files with 547 additions and 483 deletions

View file

@ -75,7 +75,9 @@ export class ZZZPlugin extends plugin {
}
// 创建米游社 API 对象
const api = new MysZZZApi(uid, ck);
const api = new MysZZZApi(uid, ck, {
handler: this.e?.runtime?.handler || {},
});
const currentCK = Object.values(ck).find(item => {
return item.ck && item.uid === uid;
});
@ -175,7 +177,11 @@ export class ZZZPlugin extends plugin {
// 获取 米游社 API
const { api, uid } = await this.getAPI();
// 获取用户信息
let userData = await api.getFinalData(this.e, 'zzzUser');
let userData = await api.getFinalData('zzzUser').catch(e => {
this.reply(e.message);
throw e;
});
if (!userData) throw new Error('获取用户数据失败');
// 取第一个用户信息
userData =