From af76458dcaf84c8bf291f16496c6b0faa5d75a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=AE=E5=B8=AE?= <11372541+bbaban@user.noreply.gitee.com> Date: Sat, 8 Jul 2023 15:44:53 +0000 Subject: [PATCH] pull MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 帮帮 <11372541+bbaban@user.noreply.gitee.com> --- plugins/genshin/apps/sevenSaints.js | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 plugins/genshin/apps/sevenSaints.js 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) + } +}