链接抽卡记录获取刷屏-转合并封装 (#196)

This commit is contained in:
FanSky_Qs 2023-07-06 09:03:51 +08:00 committed by GitHub
parent d977fccbab
commit 419dc18d8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 2 deletions

View File

@ -46,16 +46,30 @@ export default class GachaLog extends base {
this.e.reply('链接发送成功,数据获取中... 请耐心等待') this.e.reply('链接发送成功,数据获取中... 请耐心等待')
/**制作合并消息 */
let MakeMsg=[]
let tmpMsg=''
/** 按卡池更新记录 */ /** 按卡池更新记录 */
for (let i in this.pool) { for (let i in this.pool) {
this.type = this.pool[i].type this.type = this.pool[i].type
this.typeName = this.pool[i].typeName this.typeName = this.pool[i].typeName
let res = await this.updateLog() let res = await this.updateLog()
if (res) await this.e.reply(`${this.typeName}记录获取成功,更新${res.num}`) if(res){
tmpMsg+=`[${this.typeName}]记录获取成功,更新${res.num}\n`
}
if (i <= 1) await common.sleep(500) if (i <= 1) await common.sleep(500)
} }
//只去掉结尾的多余一个换行符
tmpMsg=tmpMsg.replace(/(\n)$/, '')
MakeMsg.push(tmpMsg)
MakeMsg.push(`抽卡记录更新完成,您还可回复\n【#${this?.e?.isSr?'星铁光锥':'武器'}记录】统计${this?.e?.isSr?'星铁光锥':'武器'}池数据\n【#${this?.e?.isSr?'星铁':''}角色统计】按卡池统计数据\n【#导出记录】导出记录数据`)
let Msg = await common.makeForwardMsg(this.e, MakeMsg, tmpMsg)
Msg.data=Msg.data
.replace(/\n/g, '')
.replace(/<title color="#777777" size="26">(.+?)<\/title>/g, '___')
.replace(/___+/, `<title color="#777777" size="26">${tmpMsg}</title>`)
await this.e.reply(`抽卡记录更新完成,您还可回复\n【#${this?.e?.isSr?'星铁光锥':'武器'}记录】统计${this?.e?.isSr?'星铁光锥':'武器'}池数据\n【#${this?.e?.isSr?'星铁':''}角色统计】按卡池统计数据\n【#导出记录】导出记录数据`) await this.e.reply(Msg)
this.isLogUrl = true this.isLogUrl = true