diff --git a/plugins/genshin/apps/gcLog.js b/plugins/genshin/apps/gcLog.js index 55cf312..23d5048 100644 --- a/plugins/genshin/apps/gcLog.js +++ b/plugins/genshin/apps/gcLog.js @@ -7,7 +7,7 @@ import LogCount from '../model/logCount.js' const _path = process.cwd() + '/plugins/genshin' export class gcLog extends plugin { - constructor () { + constructor() { super({ name: '抽卡记录', dsc: '抽卡记录数据统计', @@ -50,20 +50,22 @@ export class gcLog extends plugin { }) this.androidUrl = 'https://docs.qq.com/doc/DUWpYaXlvSklmVXlX' - this.prefix = this.e?.isSr ? "*" : "#" - this.button = segment.button([ - { text: "角色记录", callback: `${this.prefix}角色记录` }, - { text: "角色统计", callback: `${this.prefix}角色统计` }, - ],[ - { text: "武器记录", callback: `${this.prefix}武器记录` }, - { text: "武器统计", callback: `${this.prefix}武器统计` }, - ],[ - { text: "常驻记录", callback: `${this.prefix}常驻记录` }, - { text: "常驻统计", callback: `${this.prefix}常驻统计` }, - ]) + Object.defineProperty(this, "button", { get() { + this.prefix = this.e?.isSr ? "*" : "#" + return segment.button([ + { text: "角色记录", callback: `${this.prefix}角色记录` }, + { text: "角色统计", callback: `${this.prefix}角色统计` }, + ],[ + { text: "武器记录", callback: `${this.prefix}武器记录` }, + { text: "武器统计", callback: `${this.prefix}武器统计` }, + ],[ + { text: "常驻记录", callback: `${this.prefix}常驻记录` }, + { text: "常驻统计", callback: `${this.prefix}常驻统计` }, + ]) + }}) } - async init () { + async init() { let file = ['./data/gachaJson', './data/srJson', './temp/html/StarRail', './temp/uigf'] for (let i of file) { if (!fs.existsSync(i)) { @@ -72,7 +74,7 @@ export class gcLog extends plugin { } } - accept () { + accept() { if (this.e.file && this.e.isPrivate) { let name = this.e.file?.name if (name.includes('txt')) { @@ -91,7 +93,7 @@ export class gcLog extends plugin { } /** 抽卡记录链接 */ - async logUrl () { + async logUrl() { if (!this.e.isPrivate) { this.e.reply('请私聊发送链接', false, { at: true }) return true @@ -104,7 +106,7 @@ export class gcLog extends plugin { } /** 发送output_log.txt日志文件 */ - async logFile () { + async logFile() { if (!this.e.isPrivate) { await this.e.reply('请私聊发送日志文件', false, { at: true }) return true @@ -126,7 +128,7 @@ export class gcLog extends plugin { } /** #抽卡记录 */ - async getLog () { + async getLog() { this.e.isAll = !!(this.e.msg.includes('全部')) let data = await new GachaLog(this.e).getLogData() if (!data) return @@ -138,7 +140,7 @@ export class gcLog extends plugin { } /** 导出记录 */ - async exportLog () { + async exportLog() { if (this.e.isGroup) { await this.reply('请私聊导出', false, { at: true }) return @@ -148,7 +150,7 @@ export class gcLog extends plugin { return await exportLog.exportJson() } - async logJson () { + async logJson() { if (!this.e.isPrivate) { await this.e.reply('请私聊发送Json文件', false, { at: true }) return true @@ -162,7 +164,7 @@ export class gcLog extends plugin { await new ExportLog(this.e).logJson() } - async help () { + async help() { await this.e.reply([segment.image(`file://${_path}/resources/logHelp/记录帮助.png`), segment.button([ { text: "电脑", callback: "#电脑帮助" }, { text: "安卓", callback: "#安卓帮助" }, @@ -170,7 +172,7 @@ export class gcLog extends plugin { ])]) } - async helpPort () { + async helpPort() { let msg = this.e.msg.replace(/#|帮助/g, '') if (['电脑', 'pc'].includes(msg)) { @@ -182,7 +184,7 @@ export class gcLog extends plugin { } } - async logCount () { + async logCount() { let data = await new LogCount(this.e).count() if (!data) return diff --git a/plugins/genshin/apps/ledger.js b/plugins/genshin/apps/ledger.js index 25e62c8..7ca3a19 100644 --- a/plugins/genshin/apps/ledger.js +++ b/plugins/genshin/apps/ledger.js @@ -4,7 +4,7 @@ import puppeteer from '../../../lib/puppeteer/puppeteer.js' import fs from 'node:fs' export class ledger extends plugin { - constructor () { + constructor() { super({ name: '札记查询', dsc: '米游社札记·开拓月历查询', @@ -31,14 +31,16 @@ export class ledger extends plugin { ] }) - this.prefix = this.e?.isSr ? "*星琼" : "#原石" - this.button = segment.button([ - { text: "记录", callback: this.prefix }, - { text: "统计", callback: `${this.prefix}统计` }, - ]) + Object.defineProperty(this, "button", { get() { + this.prefix = this.e?.isSr ? "*星琼" : "#原石" + return segment.button([ + { text: "记录", callback: this.prefix }, + { text: "统计", callback: `${this.prefix}统计` }, + ]) + }}) } - async init () { + async init() { let file = ['./data/NoteData', './data/SR_NoteData'] for (let i of file) { if (!fs.existsSync(i)) { @@ -48,7 +50,7 @@ export class ledger extends plugin { } /** #原石札记 */ - async ledger () { + async ledger() { let data = await new Ledger(this.e).get() if (!data) return @@ -57,12 +59,12 @@ export class ledger extends plugin { } /** 原石任务 */ - async ledgerTask () { + async ledgerTask() { let ledger = new Ledger(this.e) await ledger.ledgerTask(!!this?.e?.msg) } - async ledgerCount () { + async ledgerCount() { let data = await new Ledger(this.e).ledgerCount() if (!data) return @@ -70,7 +72,7 @@ export class ledger extends plugin { this.reply([await this.renderImg('genshin', `html/ledger/ledger-count-${data.game}`, data, { retType: "base64" }), this.button]) } - async ledgerCountHistory () { + async ledgerCountHistory() { let data = await new Ledger(this.e).ledgerCountHistory() if (!data) return diff --git a/plugins/genshin/apps/role.js b/plugins/genshin/apps/role.js index 63479a3..fa235a9 100644 --- a/plugins/genshin/apps/role.js +++ b/plugins/genshin/apps/role.js @@ -6,7 +6,7 @@ import Abyss from '../model/abyss.js' import Weapon from '../model/weapon.js' export class role extends plugin { - constructor () { + constructor() { super({ name: '角色查询', dsc: '原神角色信息查询', @@ -30,17 +30,19 @@ export class role extends plugin { }] }) - this.prefix = this.e?.isSr ? "*" : "#" - this.button = segment.button([ - { text: "角色", callback: `${this.prefix}角色` }, - { text: "探索", callback: `${this.prefix}探索` }, - { text: "武器", callback: `${this.prefix}武器` }, - { text: "深渊", callback: `${this.prefix}深渊` }, - ]) + Object.defineProperty(this, "button", { get() { + this.prefix = this.e?.isSr ? "*" : "#" + return segment.button([ + { text: "角色", callback: `${this.prefix}角色` }, + { text: "探索", callback: `${this.prefix}探索` }, + { text: "武器", callback: `${this.prefix}武器` }, + { text: "深渊", callback: `${this.prefix}深渊` }, + ]) + }}) } /** 初始化配置文件 */ - async init () { + async init() { let pubCk = './plugins/genshin/config/mys.pubCk.yaml' if (!fs.existsSync(pubCk)) { @@ -54,7 +56,7 @@ export class role extends plugin { } /** 接受到消息都会先执行一次 */ - accept () { + accept() { if (!this.e.msg) return if (!/^#(.*)$/.test(this.e.msg)) return @@ -72,7 +74,7 @@ export class role extends plugin { } /** 深渊 */ - async abyss () { + async abyss() { let data = await new Abyss(this.e).getAbyss() console.log('abyss', data) if (!data) return @@ -81,7 +83,7 @@ export class role extends plugin { } /** 深渊十二层 */ - async abyssFloor () { + async abyssFloor() { let data = await new Abyss(this.e).getAbyssFloor() if (!data) return @@ -89,7 +91,7 @@ export class role extends plugin { } /** 武器 */ - async weapon () { + async weapon() { let data = await Weapon.get(this.e) if (!data) return @@ -97,7 +99,7 @@ export class role extends plugin { } /** 角色卡片 */ - async roleCard () { + async roleCard() { let data = await new RoleIndex(this.e).roleCard() if (!data) return @@ -105,7 +107,7 @@ export class role extends plugin { } /** 探险 */ - async roleExplore () { + async roleExplore() { let data = await new RoleIndex(this.e).roleExplore() if (!data) return diff --git a/plugins/genshin/apps/strategy.js b/plugins/genshin/apps/strategy.js index ad7332a..326a36a 100644 --- a/plugins/genshin/apps/strategy.js +++ b/plugins/genshin/apps/strategy.js @@ -192,7 +192,9 @@ export class strategy extends plugin { } if (!url) { - this.e.reply(`暂无${name}攻略(${this.source[group - 1]})\n请尝试其他的攻略来源查询\n#攻略帮助,查看说明`) + this.e.reply([`暂无${name}攻略(${this.source[group - 1]})\n请尝试其他的攻略来源查询\n#攻略帮助,查看说明`, segment.button([ + { text: "攻略帮助", callback: "#攻略帮助" }, + ])]) return false } diff --git a/plugins/genshin/defSet/artifact/data.yaml b/plugins/genshin/defSet/artifact/data.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/plugins/genshin/model/exportLog.js b/plugins/genshin/model/exportLog.js index bc560d8..9bfef28 100644 --- a/plugins/genshin/model/exportLog.js +++ b/plugins/genshin/model/exportLog.js @@ -70,7 +70,7 @@ export default class ExportLog extends base { lang: list[0].lang, export_time: moment().format('YYYY-MM-DD HH:mm:ss'), export_timestamp: moment().format('X'), - export_app: 'TRSS-Yunzai', + export_app: 'Miao-Yunzai', export_app_version: cfg.package.version, }, list