2023-07-10 14:20:02 +08:00
|
|
|
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',
|
2023-07-10 17:11:12 +08:00
|
|
|
priority: 0,
|
2023-07-10 14:20:02 +08:00
|
|
|
rule: [
|
|
|
|
{
|
2023-07-10 17:11:12 +08:00
|
|
|
reg: '^#*七圣(召唤)?查询(牌|卡)组(列表)?[0-9]{0,2}$',
|
2023-07-10 14:20:02 +08:00
|
|
|
fnc: 'deckIndex'
|
|
|
|
},
|
|
|
|
{
|
2023-07-10 17:11:12 +08:00
|
|
|
reg: '^#*七圣(召唤)?查询(角色|行动)?(卡)?牌(列表)?$',
|
2023-07-10 14:20:02 +08:00
|
|
|
fnc: 'deck_cards'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
2023-12-22 22:56:11 +08:00
|
|
|
|
|
|
|
this.button = segment.button([
|
|
|
|
{ text: "牌组", callback: `#七圣召唤查询牌组` },
|
|
|
|
{ text: "角色牌", callback: `#七圣召唤查询角色牌` },
|
|
|
|
{ text: "行动牌", callback: `#七圣召唤查询行动牌` },
|
|
|
|
])
|
2023-07-10 14:20:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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 new Deck(this.e).getIndex(id)
|
|
|
|
if (!data) return
|
|
|
|
|
|
|
|
let img = await puppeteer.screenshot('deck', data)
|
2023-12-22 22:56:11 +08:00
|
|
|
if (img) await this.reply([img, this.button])
|
2023-07-10 14:20:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async deck_list(id = 0) {
|
|
|
|
let data = await new Deck(this.e).getIndex(id, true)
|
|
|
|
if (!data) return
|
|
|
|
|
|
|
|
let img = await puppeteer.screenshot('deckList', data)
|
2023-12-22 22:56:11 +08:00
|
|
|
if (img) await this.reply([img, this.button])
|
2023-07-10 14:20:02 +08:00
|
|
|
}
|
|
|
|
async deck_cards(id = 0) {
|
|
|
|
if (this.e.msg.includes('角色')) id = 1
|
|
|
|
if (this.e.msg.includes('行动')) id = 2
|
|
|
|
await this.reply('卡牌数据获取中...')
|
|
|
|
let data = await new Deck(this.e).getcard(id)
|
|
|
|
if (!data) return
|
|
|
|
|
|
|
|
let img = await puppeteer.screenshot('deckCard', data)
|
2023-12-22 22:56:11 +08:00
|
|
|
if (img) await this.reply([img, this.button])
|
2023-07-10 14:20:02 +08:00
|
|
|
}
|
|
|
|
}
|