feat: #静默全部更新
This commit is contained in:
parent
de3e7f377c
commit
b2516e8b71
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue