mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-15 12:47:48 +00:00
50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
import { ZZZPlugin } from '../lib/plugin.js';
|
|
import settings from '../lib/settings.js';
|
|
import _ from 'lodash';
|
|
import { ZZZChallenge } from '../model/abyss.js';
|
|
import { rulePrefix } from '../lib/common.js';
|
|
|
|
export class Abyss extends ZZZPlugin {
|
|
constructor() {
|
|
super({
|
|
name: '[ZZZ-Plugin]abyss',
|
|
dsc: 'zzz式舆防卫战',
|
|
event: 'message',
|
|
priority: _.get(settings.getConfig('priority'), 'abyss', 70),
|
|
rule: [
|
|
{
|
|
reg: `${rulePrefix}(上期|往期)?(式舆防卫战|式舆|深渊|防卫战|防卫)$`,
|
|
fnc: 'abyss',
|
|
},
|
|
],
|
|
});
|
|
}
|
|
async abyss() {
|
|
const { api, deviceFp } = await this.getAPI();
|
|
await this.getPlayerInfo();
|
|
const method = this.e.msg.match(`(上期|往期)`)
|
|
? 'zzzChallengePeriod'
|
|
: 'zzzChallenge';
|
|
const abyssData = await api.getFinalData(method, {
|
|
deviceFp,
|
|
}).catch(e => {
|
|
this.reply(e.message);
|
|
throw e;
|
|
});
|
|
if (!abyssData?.has_data) {
|
|
return this.reply('没有式舆防卫战数据');
|
|
}
|
|
const abyss = new ZZZChallenge(abyssData);
|
|
const timer = setTimeout(() => {
|
|
if (this?.reply) {
|
|
this.reply('查询成功,正在下载图片资源,请稍候。');
|
|
}
|
|
}, 5000);
|
|
await abyss.get_assets();
|
|
clearTimeout(timer);
|
|
const finalData = {
|
|
abyss,
|
|
};
|
|
await this.render('abyss/index.html', finalData, this);
|
|
}
|
|
}
|