mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🌈 style: 美化代码格式,方便阅读源码!
This commit is contained in:
parent
3177408a99
commit
d01a515dc8
@ -110,7 +110,9 @@ export class tools extends plugin {
|
|||||||
// let url = `http://api.fanyi.baidu.com/api/trans/vip/translate?from=auto&to=${ transMap[language[1]] }&appid=APP ID&salt=自定义&sign=${ md5("APP ID" + place + "自定义" + "密钥") }&q=${ place }`;
|
// let url = `http://api.fanyi.baidu.com/api/trans/vip/translate?from=auto&to=${ transMap[language[1]] }&appid=APP ID&salt=自定义&sign=${ md5("APP ID" + place + "自定义" + "密钥") }&q=${ place }`;
|
||||||
let url = `http://api.fanyi.baidu.com/api/trans/vip/translate?from=auto&to=${
|
let url = `http://api.fanyi.baidu.com/api/trans/vip/translate?from=auto&to=${
|
||||||
transMap[language[1]]
|
transMap[language[1]]
|
||||||
}&appid=${this.translateAppId}&salt=rconsole&sign=${md5(this.translateAppId + place + "rconsole" + this.translateSecret)}&q=${place}`;
|
}&appid=${this.translateAppId}&salt=rconsole&sign=${md5(
|
||||||
|
this.translateAppId + place + "rconsole" + this.translateSecret
|
||||||
|
)}&q=${place}`;
|
||||||
// console.log(url)
|
// console.log(url)
|
||||||
await fetch(url)
|
await fetch(url)
|
||||||
.then(resp => resp.json())
|
.then(resp => resp.json())
|
||||||
|
@ -57,11 +57,11 @@ export class update extends plugin {
|
|||||||
|
|
||||||
const pluginName = "rconsole-plugin";
|
const pluginName = "rconsole-plugin";
|
||||||
|
|
||||||
let command = '';
|
let command = "";
|
||||||
if (isForce) {
|
if (isForce) {
|
||||||
command = `git checkout . && git -C ./plugins/${pluginName}/ pull --no-rebase`
|
command = `git checkout . && git -C ./plugins/${pluginName}/ pull --no-rebase`;
|
||||||
} else {
|
} else {
|
||||||
command = `git -C ./plugins/${pluginName}/ pull --no-rebase`
|
command = `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("正在执行更新操作,请稍等");
|
||||||
@ -139,21 +139,29 @@ export class update extends plugin {
|
|||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
async gitErr (err, stdout) {
|
async gitErr(err, stdout) {
|
||||||
let msg = '更新失败!'
|
let msg = "更新失败!";
|
||||||
let errMsg = err.toString()
|
let errMsg = err.toString();
|
||||||
stdout = stdout.toString()
|
stdout = stdout.toString();
|
||||||
if (errMsg.includes('Timed out')) {
|
if (errMsg.includes("Timed out")) {
|
||||||
await this.reply(msg + `\n连接超时:${errMsg.match(/'(.+?)'/g)[0].replace(/'/g, '')}`)
|
await this.reply(msg + `\n连接超时:${errMsg.match(/'(.+?)'/g)[0].replace(/'/g, "")}`);
|
||||||
} else if (/Failed to connect|unable to access/g.test(errMsg)) {
|
} else if (/Failed to connect|unable to access/g.test(errMsg)) {
|
||||||
await this.reply(msg + `\n连接失败:${errMsg.match(/'(.+?)'/g)[0].replace(/'/g, '')}`)
|
await this.reply(msg + `\n连接失败:${errMsg.match(/'(.+?)'/g)[0].replace(/'/g, "")}`);
|
||||||
} else if (errMsg.includes('be overwritten by merge')) {
|
} else if (errMsg.includes("be overwritten by merge")) {
|
||||||
await this.reply(msg + `存在冲突:\n${errMsg}\n` + '请解决冲突后再更新,或者执行#强制更新,放弃本地修改')
|
await this.reply(
|
||||||
} else if (stdout.includes('CONFLICT')) {
|
msg +
|
||||||
await this.reply([msg + '存在冲突\n', errMsg, stdout, '\n请解决冲突后再更新,或者执行#强制更新,放弃本地修改'])
|
`存在冲突:\n${errMsg}\n` +
|
||||||
|
"请解决冲突后再更新,或者执行#强制更新,放弃本地修改"
|
||||||
|
);
|
||||||
|
} else if (stdout.includes("CONFLICT")) {
|
||||||
|
await this.reply([
|
||||||
|
msg + "存在冲突\n",
|
||||||
|
errMsg,
|
||||||
|
stdout,
|
||||||
|
"\n请解决冲突后再更新,或者执行#强制更新,放弃本地修改",
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
await this.reply([errMsg, stdout])
|
await this.reply([errMsg, stdout]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user