Miao-Yunzai/plugins/genshin/apps/sevenSaints.js

46 lines
1.1 KiB
JavaScript

import plugin from '../../../lib/plugins/plugin.js'
import puppeteer from '../../../lib/puppeteer/puppeteer.js'
import Deck from '../model/deck.js'
export class sevenSaints extends plugin {
constructor() {
super({
name: '七圣召唤数据查询',
dsc: '原神角色信息查询',
event: 'message',
priority: 5000,
rule: [
{
reg: '^#*七圣(召唤)?(牌|卡)组(列表)?[0-9]{0,2}$',
fnc: 'deckIndex'
},
]
})
}
async deckIndex() {
let index = this.e.msg.match(/[0-9]{1,2}/g)
if (index && index[0]) {
await this.deck(index[0])
} else {
await this.deck_list()
}
}
async deck(id) {
let data = await Deck.get(this.e, id)
if (!data) return
let img = await puppeteer.screenshot('deck', data)
if (img) await this.reply(img)
}
async deck_list(id = 0) {
let data = await Deck.get(this.e, id, true)
if (!data) return
let img = await puppeteer.screenshot('deckList', data)
if (img) await this.reply(img)
}
}