feat: 强袭战

This commit is contained in:
bietiaop 2024-12-24 14:40:19 +08:00
parent fb7f746407
commit 3a88596399
14 changed files with 1066 additions and 5 deletions

50
apps/deadly.js Normal file
View file

@ -0,0 +1,50 @@
import { ZZZPlugin } from '../lib/plugin.js';
import settings from '../lib/settings.js';
import _ from 'lodash';
import { Deadly } from '../model/deadly.js';
import { rulePrefix } from '../lib/common.js';
export class Abyss extends ZZZPlugin {
constructor() {
super({
name: '[ZZZ-Plugin]deadly',
dsc: 'zzz危局强袭战',
event: 'message',
priority: _.get(settings.getConfig('priority'), 'deadly', 70),
rule: [
{
reg: `${rulePrefix}(上期|往期)?(危局强袭战|危局|强袭|强袭战)$`,
fnc: 'deadly',
},
],
});
}
async deadly() {
const { api } = await this.getAPI();
await this.getPlayerInfo();
const method = this.e.msg.match(`(上期|往期)`)
? 'zzzDeadlyPeriod'
: 'zzzDeadly';
const deadlyData = await api.getFinalData(method).catch(e => {
this.reply(e.message);
throw e;
});
if (!deadlyData?.has_data) {
await this.reply('没有危局强袭战数据');
return false;
}
const deadly = new Deadly(deadlyData);
const timer = setTimeout(() => {
if (this?.reply) {
this.reply('查询成功,正在下载图片资源,请稍候。');
}
}, 5000);
await deadly.get_assets();
clearTimeout(timer);
const finalData = {
deadly,
};
logger.debug(JSON.stringify(finalData, null, 2));
await this.render('deadly/index.html', finalData, this);
}
}

View file

@ -144,20 +144,20 @@ const helpData = [
],
},
{
title: '式舆防卫战',
title: '绩查询',
icon: 'dungeon',
items: [
{
title: '查看式舆防卫战',
desc: '查看式舆防卫战(深渊)信息',
needCK: false,
needCK: true,
needSK: false,
commands: ['式舆防卫战', '防卫战', '式舆', '深渊', '防卫'],
},
{
title: '查看上期式舆防卫战',
desc: '查看上期式舆防卫战(深渊)信息',
needCK: false,
needCK: true,
needSK: false,
commands: [
'上期式舆防卫战',
@ -167,6 +167,20 @@ const helpData = [
'上期防卫',
],
},
{
title: '查看危局强袭战',
desc: '查看式危局强袭战信息',
needCK: true,
needSK: false,
commands: ['危局强袭战', '危局', '强袭', '强袭战'],
},
{
title: '查看上期危局强袭战',
desc: '查看上期危局强袭战信息',
needCK: true,
needSK: false,
commands: ['上期式舆防卫战', '上期危局', '上期强袭', '上期强袭战'],
},
],
},
{