fix: 修复reply丢失

This commit is contained in:
ningmengchongshui 2024-06-15 14:56:29 +08:00
parent bb5efd5044
commit bc706abfa2
1 changed files with 10 additions and 10 deletions

View File

@ -175,27 +175,28 @@ export class update extends Plugin {
async updateAll() { async updateAll() {
const dirs = fs.readdirSync('./plugins/') const dirs = fs.readdirSync('./plugins/')
const originalReply = this.reply const MSG = (message)=>{
// 收集
this.messages.push(message)
}
const testReg = /^#静默全部(强制)?更新$/.test(this.e.msg) const testReg = /^#静默全部(强制)?更新$/.test(this.e.msg)
if (testReg) { if (testReg) {
await this.reply(`开始执行静默全部更新,请稍等...`) await this.reply(`开始执行静默全部更新,请稍等...`)
this.reply = (message) => {
this.messages.push(message)
}
} }
await this.runUpdate() await this.runUpdate()
for (let plu of dirs) { for (const plu of dirs) {
plu = this.getPlugin(plu) const Plu = this.getPlugin(plu)
if (plu === false) continue if (Plu === false) continue
await sleep(1500) await sleep(1500)
await this.runUpdate(plu) await this.runUpdate(Plu)
} }
if (testReg) { if (testReg) {
await this.reply(await makeForwardMsg(this.e, this.messages)) const msg = await makeForwardMsg(this.e, this.messages)
MSG(msg)
} }
if (this.isUp) { if (this.isUp) {
@ -203,7 +204,6 @@ export class update extends Plugin {
setTimeout(() => this.restart(), 2000) setTimeout(() => this.restart(), 2000)
} }
this.reply = originalReply
} }
restart() { restart() {