修复按钮错误

This commit is contained in:
🌌 2023-12-27 18:15:06 +08:00
parent 305e97b1f7
commit 24fbf7e150
6 changed files with 58 additions and 50 deletions

View File

@ -7,7 +7,7 @@ import LogCount from '../model/logCount.js'
const _path = process.cwd() + '/plugins/genshin' const _path = process.cwd() + '/plugins/genshin'
export class gcLog extends plugin { export class gcLog extends plugin {
constructor () { constructor() {
super({ super({
name: '抽卡记录', name: '抽卡记录',
dsc: '抽卡记录数据统计', dsc: '抽卡记录数据统计',
@ -50,20 +50,22 @@ export class gcLog extends plugin {
}) })
this.androidUrl = 'https://docs.qq.com/doc/DUWpYaXlvSklmVXlX' this.androidUrl = 'https://docs.qq.com/doc/DUWpYaXlvSklmVXlX'
this.prefix = this.e?.isSr ? "*" : "#" Object.defineProperty(this, "button", { get() {
this.button = segment.button([ this.prefix = this.e?.isSr ? "*" : "#"
{ text: "角色记录", callback: `${this.prefix}角色记录` }, 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}武器记录` },
],[ { 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'] let file = ['./data/gachaJson', './data/srJson', './temp/html/StarRail', './temp/uigf']
for (let i of file) { for (let i of file) {
if (!fs.existsSync(i)) { if (!fs.existsSync(i)) {
@ -72,7 +74,7 @@ export class gcLog extends plugin {
} }
} }
accept () { accept() {
if (this.e.file && this.e.isPrivate) { if (this.e.file && this.e.isPrivate) {
let name = this.e.file?.name let name = this.e.file?.name
if (name.includes('txt')) { if (name.includes('txt')) {
@ -91,7 +93,7 @@ export class gcLog extends plugin {
} }
/** 抽卡记录链接 */ /** 抽卡记录链接 */
async logUrl () { async logUrl() {
if (!this.e.isPrivate) { if (!this.e.isPrivate) {
this.e.reply('请私聊发送链接', false, { at: true }) this.e.reply('请私聊发送链接', false, { at: true })
return true return true
@ -104,7 +106,7 @@ export class gcLog extends plugin {
} }
/** 发送output_log.txt日志文件 */ /** 发送output_log.txt日志文件 */
async logFile () { async logFile() {
if (!this.e.isPrivate) { if (!this.e.isPrivate) {
await this.e.reply('请私聊发送日志文件', false, { at: true }) await this.e.reply('请私聊发送日志文件', false, { at: true })
return true return true
@ -126,7 +128,7 @@ export class gcLog extends plugin {
} }
/** #抽卡记录 */ /** #抽卡记录 */
async getLog () { async getLog() {
this.e.isAll = !!(this.e.msg.includes('全部')) this.e.isAll = !!(this.e.msg.includes('全部'))
let data = await new GachaLog(this.e).getLogData() let data = await new GachaLog(this.e).getLogData()
if (!data) return if (!data) return
@ -138,7 +140,7 @@ export class gcLog extends plugin {
} }
/** 导出记录 */ /** 导出记录 */
async exportLog () { async exportLog() {
if (this.e.isGroup) { if (this.e.isGroup) {
await this.reply('请私聊导出', false, { at: true }) await this.reply('请私聊导出', false, { at: true })
return return
@ -148,7 +150,7 @@ export class gcLog extends plugin {
return await exportLog.exportJson() return await exportLog.exportJson()
} }
async logJson () { async logJson() {
if (!this.e.isPrivate) { if (!this.e.isPrivate) {
await this.e.reply('请私聊发送Json文件', false, { at: true }) await this.e.reply('请私聊发送Json文件', false, { at: true })
return true return true
@ -162,7 +164,7 @@ export class gcLog extends plugin {
await new ExportLog(this.e).logJson() await new ExportLog(this.e).logJson()
} }
async help () { async help() {
await this.e.reply([segment.image(`file://${_path}/resources/logHelp/记录帮助.png`), segment.button([ await this.e.reply([segment.image(`file://${_path}/resources/logHelp/记录帮助.png`), segment.button([
{ text: "电脑", callback: "#电脑帮助" }, { text: "电脑", callback: "#电脑帮助" },
{ text: "安卓", callback: "#安卓帮助" }, { text: "安卓", callback: "#安卓帮助" },
@ -170,7 +172,7 @@ export class gcLog extends plugin {
])]) ])])
} }
async helpPort () { async helpPort() {
let msg = this.e.msg.replace(/#|帮助/g, '') let msg = this.e.msg.replace(/#|帮助/g, '')
if (['电脑', 'pc'].includes(msg)) { 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() let data = await new LogCount(this.e).count()
if (!data) return if (!data) return

View File

@ -4,7 +4,7 @@ import puppeteer from '../../../lib/puppeteer/puppeteer.js'
import fs from 'node:fs' import fs from 'node:fs'
export class ledger extends plugin { export class ledger extends plugin {
constructor () { constructor() {
super({ super({
name: '札记查询', name: '札记查询',
dsc: '米游社札记·开拓月历查询', dsc: '米游社札记·开拓月历查询',
@ -31,14 +31,16 @@ export class ledger extends plugin {
] ]
}) })
this.prefix = this.e?.isSr ? "*星琼" : "#原石" Object.defineProperty(this, "button", { get() {
this.button = segment.button([ this.prefix = this.e?.isSr ? "*星琼" : "#原石"
{ text: "记录", callback: this.prefix }, return segment.button([
{ text: "统计", callback: `${this.prefix}统计` }, { text: "记录", callback: this.prefix },
]) { text: "统计", callback: `${this.prefix}统计` },
])
}})
} }
async init () { async init() {
let file = ['./data/NoteData', './data/SR_NoteData'] let file = ['./data/NoteData', './data/SR_NoteData']
for (let i of file) { for (let i of file) {
if (!fs.existsSync(i)) { 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() let data = await new Ledger(this.e).get()
if (!data) return if (!data) return
@ -57,12 +59,12 @@ export class ledger extends plugin {
} }
/** 原石任务 */ /** 原石任务 */
async ledgerTask () { async ledgerTask() {
let ledger = new Ledger(this.e) let ledger = new Ledger(this.e)
await ledger.ledgerTask(!!this?.e?.msg) await ledger.ledgerTask(!!this?.e?.msg)
} }
async ledgerCount () { async ledgerCount() {
let data = await new Ledger(this.e).ledgerCount() let data = await new Ledger(this.e).ledgerCount()
if (!data) return 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]) 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() let data = await new Ledger(this.e).ledgerCountHistory()
if (!data) return if (!data) return

View File

@ -6,7 +6,7 @@ import Abyss from '../model/abyss.js'
import Weapon from '../model/weapon.js' import Weapon from '../model/weapon.js'
export class role extends plugin { export class role extends plugin {
constructor () { constructor() {
super({ super({
name: '角色查询', name: '角色查询',
dsc: '原神角色信息查询', dsc: '原神角色信息查询',
@ -30,17 +30,19 @@ export class role extends plugin {
}] }]
}) })
this.prefix = this.e?.isSr ? "*" : "#" Object.defineProperty(this, "button", { get() {
this.button = segment.button([ this.prefix = this.e?.isSr ? "*" : "#"
{ text: "角色", callback: `${this.prefix}角色` }, 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}武器` },
]) { text: "深渊", callback: `${this.prefix}深渊` },
])
}})
} }
/** 初始化配置文件 */ /** 初始化配置文件 */
async init () { async init() {
let pubCk = './plugins/genshin/config/mys.pubCk.yaml' let pubCk = './plugins/genshin/config/mys.pubCk.yaml'
if (!fs.existsSync(pubCk)) { if (!fs.existsSync(pubCk)) {
@ -54,7 +56,7 @@ export class role extends plugin {
} }
/** 接受到消息都会先执行一次 */ /** 接受到消息都会先执行一次 */
accept () { accept() {
if (!this.e.msg) return if (!this.e.msg) return
if (!/^#(.*)$/.test(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() let data = await new Abyss(this.e).getAbyss()
console.log('abyss', data) console.log('abyss', data)
if (!data) return if (!data) return
@ -81,7 +83,7 @@ export class role extends plugin {
} }
/** 深渊十二层 */ /** 深渊十二层 */
async abyssFloor () { async abyssFloor() {
let data = await new Abyss(this.e).getAbyssFloor() let data = await new Abyss(this.e).getAbyssFloor()
if (!data) return if (!data) return
@ -89,7 +91,7 @@ export class role extends plugin {
} }
/** 武器 */ /** 武器 */
async weapon () { async weapon() {
let data = await Weapon.get(this.e) let data = await Weapon.get(this.e)
if (!data) return if (!data) return
@ -97,7 +99,7 @@ export class role extends plugin {
} }
/** 角色卡片 */ /** 角色卡片 */
async roleCard () { async roleCard() {
let data = await new RoleIndex(this.e).roleCard() let data = await new RoleIndex(this.e).roleCard()
if (!data) return if (!data) return
@ -105,7 +107,7 @@ export class role extends plugin {
} }
/** 探险 */ /** 探险 */
async roleExplore () { async roleExplore() {
let data = await new RoleIndex(this.e).roleExplore() let data = await new RoleIndex(this.e).roleExplore()
if (!data) return if (!data) return

View File

@ -192,7 +192,9 @@ export class strategy extends plugin {
} }
if (!url) { 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 return false
} }

View File

@ -70,7 +70,7 @@ export default class ExportLog extends base {
lang: list[0].lang, lang: list[0].lang,
export_time: moment().format('YYYY-MM-DD HH:mm:ss'), export_time: moment().format('YYYY-MM-DD HH:mm:ss'),
export_timestamp: moment().format('X'), export_timestamp: moment().format('X'),
export_app: 'TRSS-Yunzai', export_app: 'Miao-Yunzai',
export_app_version: cfg.package.version, export_app_version: cfg.package.version,
}, },
list list