#喵喵强制更新图像 命令

This commit is contained in:
yoimiya-kokomi 2022-10-31 02:36:01 +08:00
parent 498982b9ea
commit b5b4389888
2 changed files with 6 additions and 10 deletions

View File

@ -27,7 +27,7 @@ let app = App.init({
let sysCfgReg = new RegExp(`^#喵喵设置\\s*(${lodash.keys(cfgMap).join('|')})?\\s*(.*)$`) let sysCfgReg = new RegExp(`^#喵喵设置\\s*(${lodash.keys(cfgMap).join('|')})?\\s*(.*)$`)
app.reg('update-res', updateRes, { app.reg('update-res', updateRes, {
rule: /^#喵喵(更新图像|图像更新)$/, rule: /^#喵喵(强制)?(更新图像|图像更新)$/,
desc: '【#管理】更新素材' desc: '【#管理】更新素材'
}) })
app.reg('update', updateMiaoPlugin, { app.reg('update', updateMiaoPlugin, {
@ -120,10 +120,14 @@ async function updateRes (e) {
if (!await checkAuth(e)) { if (!await checkAuth(e)) {
return true return true
} }
let isForce = e.msg.includes('强制')
let command = '' let command = ''
if (fs.existsSync(`${resPath}/miao-res-plus/`)) { if (fs.existsSync(`${resPath}/miao-res-plus/`)) {
e.reply('开始尝试更新,请耐心等待~') e.reply('开始尝试更新,请耐心等待~')
command = 'git pull' command = 'git pull'
if (isForce) {
command = 'git checkout . && git pull'
}
exec(command, { cwd: `${resPath}/miao-res-plus/` }, function (error, stdout, stderr) { exec(command, { cwd: `${resPath}/miao-res-plus/` }, function (error, stdout, stderr) {
console.log(stdout) console.log(stdout)
if (/(Already up[ -]to[ -]date|已经是最新的)/.test(stdout)) { if (/(Already up[ -]to[ -]date|已经是最新的)/.test(stdout)) {
@ -142,7 +146,7 @@ async function updateRes (e) {
} }
}) })
} else { } else {
command = `git clone https://gitee.com/yoimiya-kokomi/miao-res-plus.git "${resPath}/miao-res-plus/"` command = `git clone https://gitee.com/yoimiya-kokomi/miao-res-plus.git "${resPath}/miao-res-plus/" --depth=1`
e.reply('开始尝试安装图片加量包,可能会需要一段时间,请耐心等待~') e.reply('开始尝试安装图片加量包,可能会需要一段时间,请耐心等待~')
exec(command, function (error, stdout, stderr) { exec(command, function (error, stdout, stderr) {
if (error) { if (error) {

View File

@ -41,14 +41,6 @@
{{@poke}} {{@poke}}
</div> </div>
</li> </li>
<li class="cfg-li">
<div class="cfg-line">
允许查他人
<span class="cfg-hint"> #喵喵设置查他人 + 开启/关闭</span>
{{@other}}
</div>
<div class="cfg-desc">暂不支持关闭面板的查他人</div>
</li>
</ul> </ul>
</div> </div>
<div class="cfg-box"> <div class="cfg-box">