mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
fix: 部分逻辑
This commit is contained in:
parent
34cd8b15dc
commit
70836ab785
9 changed files with 204 additions and 173 deletions
|
|
@ -21,13 +21,12 @@ export class Abyss extends ZZZPlugin {
|
|||
});
|
||||
}
|
||||
async abyss() {
|
||||
const { api, deviceFp } = await this.getAPI();
|
||||
if (!api) return false;
|
||||
const { api } = await this.getAPI();
|
||||
await this.getPlayerInfo();
|
||||
const method = this.e.msg.match(`(上期|往期)`) ? 'zzzChallengePeriod' : 'zzzChallenge';
|
||||
const abyssData = await api.getFinalData(this.e, method, {
|
||||
deviceFp,
|
||||
});
|
||||
const method = this.e.msg.match(`(上期|往期)`)
|
||||
? 'zzzChallengePeriod'
|
||||
: 'zzzChallenge';
|
||||
const abyssData = await api.getFinalData(this.e, method);
|
||||
if (!abyssData?.has_data) {
|
||||
await this.reply('没有式舆防卫战数据');
|
||||
return false;
|
||||
|
|
@ -37,7 +36,7 @@ export class Abyss extends ZZZPlugin {
|
|||
if (this?.reply) {
|
||||
this.reply('查询成功,正在下载图片资源,请稍候。');
|
||||
}
|
||||
}, 3000);
|
||||
}, 5000);
|
||||
await abyss.get_assets();
|
||||
clearTimeout(timer);
|
||||
const finalData = {
|
||||
|
|
|
|||
15
apps/card.js
15
apps/card.js
|
|
@ -21,21 +21,16 @@ export class Card extends ZZZPlugin {
|
|||
});
|
||||
}
|
||||
async card() {
|
||||
const { api, deviceFp } = await this.getAPI();
|
||||
if (!api) return false;
|
||||
const { api } = await this.getAPI();
|
||||
await this.getPlayerInfo();
|
||||
const indexData = await api.getFinalData(this.e, 'zzzIndex', { deviceFp });
|
||||
const indexData = await api.getFinalData(this.e, 'zzzIndex');
|
||||
if (!indexData) return false;
|
||||
|
||||
let zzzAvatarList = await api.getFinalData(this.e, 'zzzAvatarList', {
|
||||
deviceFp,
|
||||
});
|
||||
let zzzAvatarList = await api.getFinalData(this.e, 'zzzAvatarList');
|
||||
if (!zzzAvatarList) return false;
|
||||
indexData.avatar_list = zzzAvatarList.avatar_list;
|
||||
|
||||
let zzzBuddyList = await api.getFinalData(this.e, 'zzzBuddyList', {
|
||||
deviceFp,
|
||||
});
|
||||
let zzzBuddyList = await api.getFinalData(this.e, 'zzzBuddyList');
|
||||
if (!zzzBuddyList) return false;
|
||||
indexData.buddy_list = zzzBuddyList.list;
|
||||
const finalIndexData = new ZZZIndexResp(indexData);
|
||||
|
|
@ -45,7 +40,7 @@ export class Card extends ZZZPlugin {
|
|||
if (this?.reply) {
|
||||
this.reply('查询成功,正在下载图片资源,请稍候。');
|
||||
}
|
||||
}, 3000);
|
||||
}, 5000);
|
||||
await finalIndexData.get_assets();
|
||||
clearTimeout(timer);
|
||||
const data = {
|
||||
|
|
|
|||
|
|
@ -21,12 +21,9 @@ export class Note extends ZZZPlugin {
|
|||
});
|
||||
}
|
||||
async note() {
|
||||
const { api, deviceFp } = await this.getAPI();
|
||||
if (!api) return false;
|
||||
const { api } = await this.getAPI();
|
||||
await this.getPlayerInfo();
|
||||
const noteResponse = await api.getFinalData(this.e, 'zzzNote', {
|
||||
deviceFp,
|
||||
});
|
||||
const noteResponse = await api.getFinalData(this.e, 'zzzNote');
|
||||
if (!noteResponse) return false;
|
||||
const noteData = new ZZZNoteResp(noteResponse);
|
||||
const finalData = {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ export class Panel extends ZZZPlugin {
|
|||
|
||||
async refreshPanel() {
|
||||
const uid = await this.getUID();
|
||||
if (!uid) return;
|
||||
const lastQueryTime = await redis.get(`ZZZ:PANEL:${uid}:LASTTIME`);
|
||||
const panelSettings = settings.getConfig('panel');
|
||||
const coldTime = _.get(panelSettings, 'interval', 300);
|
||||
|
|
@ -51,12 +50,11 @@ export class Panel extends ZZZPlugin {
|
|||
await this.reply(`${coldTime}秒内只能刷新一次,请稍后再试`);
|
||||
return false;
|
||||
}
|
||||
const { api, deviceFp } = await this.getAPI();
|
||||
if (!api) return false;
|
||||
const { api } = await this.getAPI();
|
||||
await redis.set(`ZZZ:PANEL:${uid}:LASTTIME`, Date.now());
|
||||
await this.reply('正在刷新面板列表,请稍候...');
|
||||
await this.getPlayerInfo();
|
||||
const result = await refreshPanel(this.e, api, uid, deviceFp);
|
||||
const result = await refreshPanel(this.e, api, uid);
|
||||
if (!result) {
|
||||
await this.reply('面板列表刷新失败,请稍后再试');
|
||||
return false;
|
||||
|
|
@ -70,7 +68,6 @@ export class Panel extends ZZZPlugin {
|
|||
}
|
||||
async getCharPanelList() {
|
||||
const uid = await this.getUID();
|
||||
if (!uid) return false;
|
||||
const result = getPanelList(uid);
|
||||
if (!result) {
|
||||
await this.reply('未找到面板数据,请先%刷新面板');
|
||||
|
|
@ -81,7 +78,7 @@ export class Panel extends ZZZPlugin {
|
|||
if (this?.reply) {
|
||||
this.reply('查询成功,正在下载图片资源,请稍候。');
|
||||
}
|
||||
}, 3000);
|
||||
}, 5000);
|
||||
for (const item of result) {
|
||||
await item.get_basic_assets();
|
||||
}
|
||||
|
|
@ -94,7 +91,6 @@ export class Panel extends ZZZPlugin {
|
|||
}
|
||||
async getCharPanel() {
|
||||
const uid = await this.getUID();
|
||||
if (!uid) return false;
|
||||
const reg = new RegExp(`${rulePrefix}(.+)面板$`);
|
||||
const match = this.e.msg.match(reg);
|
||||
if (!match) return false;
|
||||
|
|
@ -108,7 +104,7 @@ export class Panel extends ZZZPlugin {
|
|||
if (this?.reply) {
|
||||
this.reply('查询成功,正在下载图片资源,请稍候。');
|
||||
}
|
||||
}, 3000);
|
||||
}, 5000);
|
||||
await data.get_detail_assets();
|
||||
clearTimeout(timer);
|
||||
const finalData = {
|
||||
|
|
@ -128,7 +124,6 @@ export class Panel extends ZZZPlugin {
|
|||
}
|
||||
async proficiency() {
|
||||
const uid = await this.getUID();
|
||||
if (!uid) return false;
|
||||
const result = getPanelList(uid);
|
||||
if (!result) {
|
||||
await this.reply('未找到面板数据,请先%刷新面板');
|
||||
|
|
@ -160,7 +155,7 @@ export class Panel extends ZZZPlugin {
|
|||
if (this?.reply) {
|
||||
this.reply('查询成功,正在下载图片资源,请稍候。');
|
||||
}
|
||||
}, 3000);
|
||||
}, 5000);
|
||||
for (const item of result) {
|
||||
await item.get_small_basic_assets();
|
||||
}
|
||||
|
|
|
|||
57
apps/user.js
57
apps/user.js
|
|
@ -16,6 +16,10 @@ export class Panel extends ZZZPlugin {
|
|||
reg: `${rulePrefix}绑定设备$`,
|
||||
fnc: 'bindDevice',
|
||||
},
|
||||
{
|
||||
reg: `${rulePrefix}解绑设备$`,
|
||||
fnc: 'deleteBind',
|
||||
},
|
||||
{
|
||||
reg: `${rulePrefix}绑定设备帮助$`,
|
||||
fnc: 'bindDeviceHelp',
|
||||
|
|
@ -25,9 +29,6 @@ export class Panel extends ZZZPlugin {
|
|||
}
|
||||
async bindDevice() {
|
||||
const uid = await this.getUID();
|
||||
if (!uid) {
|
||||
this.reply('未绑定UID');
|
||||
}
|
||||
this.setContext('toBindDevice');
|
||||
await this.reply(
|
||||
`为UID ${uid}绑定设备,请发送设备信息,或者发送“取消”取消绑定`,
|
||||
|
|
@ -58,13 +59,20 @@ export class Panel extends ZZZPlugin {
|
|||
this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 });
|
||||
return false;
|
||||
}
|
||||
if (!!info?.device_id && !!info.device_fp) {
|
||||
await redis.set(`ZZZ:DEVICE_FP:${ltuid}:FP`, info.device_fp);
|
||||
await redis.set(`ZZZ:DEVICE_FP:${ltuid}:ID`, info.device_id);
|
||||
await this.reply('绑定设备成功', false, { at: true, recallMsg: 100 });
|
||||
this.finish('toBindDevice');
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
!'deviceName' in info ||
|
||||
!'deviceBoard' in info ||
|
||||
!'deviceModel' in info ||
|
||||
!'oaid' in info ||
|
||||
!'deviceFingerprint' in info ||
|
||||
!'deviceProduct' in info
|
||||
!info?.deviceName ||
|
||||
!info?.deviceBoard ||
|
||||
!info?.deviceModel ||
|
||||
!info?.oaid ||
|
||||
!info?.deviceFingerprint ||
|
||||
!info?.deviceProduct
|
||||
) {
|
||||
this.reply('设备信息格式错误', false, { at: true, recallMsg: 100 });
|
||||
return false;
|
||||
|
|
@ -86,16 +94,41 @@ export class Panel extends ZZZPlugin {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
async deleteBind() {
|
||||
const ltuid = await this.getLtuid();
|
||||
await redis.del(`ZZZ:DEVICE_FP:${ltuid}:FP`);
|
||||
await redis.del(`ZZZ:DEVICE_FP:${ltuid}:BIND`);
|
||||
await redis.del(`ZZZ:DEVICE_FP:${ltuid}:ID`);
|
||||
await this.reply('解绑设备成功', false, { at: true, recallMsg: 100 });
|
||||
}
|
||||
async bindDeviceHelp() {
|
||||
const msgs = [
|
||||
'绑定设备帮助',
|
||||
settings.getConfig('config')?.url,
|
||||
'1. 使用常用米游社手机下载以上APK,并安装',
|
||||
'[绑定设备]',
|
||||
'方法一:',
|
||||
'1. 使用抓包软件抓取米游社APP的请求',
|
||||
'2. 在请求头内找到【x-rpc-device_id】和【x-rpc-device_fp】',
|
||||
'3. 自行构造如下格式的信息:',
|
||||
' {device_id: "x-rpc-device_id的内容", device_fp: "x-rpc-device_fp的内容"}',
|
||||
'4. 给机器人发送"%绑定设备"指令',
|
||||
'5. 机器人会提示发送设备信息',
|
||||
'6. 粘贴自行构造的信息发送',
|
||||
'7. 提示绑定成功',
|
||||
'--------------------------------',
|
||||
'方法二(仅适用于安卓设备):',
|
||||
'1. 使用常用米游社手机下载下面链接的APK文件,并安装',
|
||||
_.get(
|
||||
settings.getConfig('config'),
|
||||
'url',
|
||||
'https://ghproxy.mihomo.me/https://raw.githubusercontent.com/forchannot/get_device_info/main/app/build/outputs/apk/debug/app-debug.apk'
|
||||
),
|
||||
'2. 打开后点击按钮复制',
|
||||
'3. 给机器人发送"%绑定设备"指令',
|
||||
'4. 机器人会提示发送设备信息',
|
||||
'5. 粘贴设备信息发送',
|
||||
'6. 提示绑定成功',
|
||||
'--------------------------------',
|
||||
'[解绑设备]',
|
||||
'发送 %解绑设备 即可',
|
||||
],
|
||||
msg = msgs.join('\n');
|
||||
await this.reply(await common.makeForwardMsg(this.e, msg, '绑定设备帮助'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue