feat: #静默全部更新

This commit is contained in:
SmallK111407 2024-03-22 20:48:41 +08:00
parent de3e7f377c
commit b2516e8b71
1 changed files with 27 additions and 13 deletions

View File

@ -27,7 +27,7 @@ export class update extends plugin {
fnc: 'update'
},
{
reg: '^#全部(强制)?更新$',
reg: '^#(静默?)全部(强制)?更新$',
fnc: 'updateAll',
permission: 'master'
}
@ -35,6 +35,7 @@ export class update extends plugin {
})
this.typeName = 'Miao-Yunzai'
this.messages = []
}
async update() {
@ -178,6 +179,15 @@ export class update extends plugin {
async updateAll() {
const dirs = fs.readdirSync('./plugins/')
const originalReply = this.reply
if (/^#静默全部(强制)?更新$/.test(this.e.msg)) {
await this.e.reply(`开始执行静默全部更新...请稍等`)
this.reply = (message) => {
this.messages.push(message)
}
}
await this.runUpdate()
for (let plu of dirs) {
@ -187,10 +197,14 @@ export class update extends plugin {
await this.runUpdate(plu)
}
await this.e.reply(await common.makeForwardMsg(this.e, this.messages))
if (this.isUp) {
// await this.reply('即将执行重启,以应用更新')
setTimeout(() => this.restart(), 2000)
}
this.reply = originalReply
}
restart() {