diff --git a/plugins/genshin/apps/sevenSaints.js b/plugins/genshin/apps/sevenSaints.js new file mode 100644 index 0000000..c9f8521 --- /dev/null +++ b/plugins/genshin/apps/sevenSaints.js @@ -0,0 +1,45 @@ +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) + } +}