mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
#喵喵强制更新图像
命令
This commit is contained in:
parent
498982b9ea
commit
b5b4389888
@ -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) {
|
||||||
|
@ -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">
|
||||||
|
Loading…
Reference in New Issue
Block a user