mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
card basic
This commit is contained in:
parent
51fb65cdb4
commit
cd0793655d
32 changed files with 807 additions and 260 deletions
40
apps/card.js
Normal file
40
apps/card.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { ZZZPlugin } from '../lib/plugin.js';
|
||||
import _ from 'lodash';
|
||||
import render from '../lib/render.js';
|
||||
import { rulePrefix } from '../lib/common.js';
|
||||
import { ZZZIndexResp } from '../model/index.js';
|
||||
|
||||
export class Card extends ZZZPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
name: '[ZZZ-Plugin]Card',
|
||||
dsc: 'zzzcard',
|
||||
event: 'message',
|
||||
priority: 100,
|
||||
rule: [
|
||||
{
|
||||
reg: `${rulePrefix}card$`,
|
||||
fnc: 'card',
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
async card() {
|
||||
const { api, deviceFp } = await this.getAPI();
|
||||
const userData = await this.getPlayerInfo();
|
||||
if (!userData) return false;
|
||||
let indexData = await api.getData('zzzIndex', { deviceFp });
|
||||
indexData = await api.checkCode(this.e, indexData, 'zzzIndex', {});
|
||||
if (!indexData || indexData.retcode !== 0) {
|
||||
await this.reply('[zzznote]Index数据获取失败');
|
||||
return false;
|
||||
}
|
||||
indexData = indexData.data;
|
||||
indexData = new ZZZIndexResp(indexData);
|
||||
this.e.playerCard.player.region_name = indexData.stats.world_level_name;
|
||||
const data = {
|
||||
card: indexData,
|
||||
};
|
||||
await render(this.e, 'card/index.html', data);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue