🐞 fix: #R插件更新修复

This commit is contained in:
zhiyu1998 2023-02-15 14:57:34 +08:00
parent 0a9da6d6ba
commit e4a64059e2

View File

@ -23,7 +23,7 @@ export class update extends plugin {
}, },
{ {
/** 命令正则匹配 */ /** 命令正则匹配 */
reg: "^#*R(插件)?更新$", reg: "^#*R(插件)?(强制更新|更新)$",
/** 执行方法 */ /** 执行方法 */
fnc: "rconsoleUpdate", fnc: "rconsoleUpdate",
}, },
@ -52,9 +52,17 @@ export class update extends plugin {
await this.e.reply("您无权操作"); await this.e.reply("您无权操作");
return true; return true;
} }
let isForce = !!this.e.msg.includes("强制");
const pluginName = "rconsole-plugin"; const pluginName = "rconsole-plugin";
let command = `git -C ./plugins/${pluginName}/ pull --no-rebase`; let command = '';
if (isForce) {
command = `git -C ./plugins/${pluginName}/ pull --no-rebase`
} else {
command = `git checkout ./plugins/${pluginName}/ && git -C ./plugins/${pluginName}/ pull --no-rebase`
}
this.oldCommitId = await this.getcommitId(pluginName); this.oldCommitId = await this.getcommitId(pluginName);
await e.reply("正在执行更新操作,请稍等"); await e.reply("正在执行更新操作,请稍等");