diff --git a/.eslintrc.cjs b/.eslintrc.cjs index f590272..7edaef0 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -3,12 +3,12 @@ module.exports = { es2021: true, node: true }, - extends: ['standard', 'plugin:jsdoc/recommended'], + extends: ['standard', 'plugin:jsdoc/recommended', 'plugin:import/recommended', 'plugin:promise/recommended'], parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, - plugins: ['import', 'n', 'promise', 'jsdoc'], + plugins: ['import', 'promise', 'jsdoc'], globals: { Bot: true, redis: true, diff --git a/apps/assistant.js b/apps/assistant.js index 72f44b5..c0783ac 100644 --- a/apps/assistant.js +++ b/apps/assistant.js @@ -151,7 +151,7 @@ export class Assistant extends plugin { } await this.Bot.setAvatar(e.img[0]) - .then(() => { e.reply('✅ 头像修改成功') }) + .then(() => e.reply('✅ 头像修改成功')) .catch((err) => { e.reply('❎ 头像修改失败') logger.error(err) diff --git a/apps/handle.js b/apps/handle.js index a14b22f..473833f 100644 --- a/apps/handle.js +++ b/apps/handle.js @@ -243,7 +243,7 @@ export class NewHandle extends plugin { if (group) { logger.mark(`${e.logFnc}回复临时消息`) return (e.bot ?? Bot).sendTempMsg(group, qq, e.message) - .then(() => { e.reply('✅ 已把消息发给它了哦~') }) + .then(() => e.reply('✅ 已把消息发给它了哦~')) .catch((err) => common.handleException(e, err, { MsgTemplate: '❎ 发送失败\n错误信息为:{error}' })) } @@ -255,7 +255,7 @@ export class NewHandle extends plugin { (e.bot ?? Bot).pickFriend(qq) .sendMsg(e.message) - .then(() => { e.reply('✅ 已把消息发给它了哦~') }) + .then(() => e.reply('✅ 已把消息发给它了哦~')) .catch((err) => common.handleException(e, err, { MsgTemplate: '❎ 发送失败\n错误信息为:{error}' })) } diff --git a/apps/picSearch.js b/apps/picSearch.js index 68b1d73..70ef72c 100644 --- a/apps/picSearch.js +++ b/apps/picSearch.js @@ -37,11 +37,10 @@ export class NewPicSearch extends plugin { if (!await this._Authentication(e)) return if (!await this.handelImg(e, 'SauceNAO')) return await PicSearch.SauceNAO(e.img[0]) - .then(async res => { - res.length == 1 - ? common.recallsendMsg(e, res[0], true) - : common.recallSendForwardMsg(e, res, { xmlTitle: false }) - }) + .then(async res => res.length == 1 + ? common.recallsendMsg(e, res[0], true) + : common.recallSendForwardMsg(e, res, { xmlTitle: false }) + ) .catch(async err => { await common.handleException(e, err) if (Config.picSearch.useAscii2dWhenFailed) { @@ -67,6 +66,7 @@ export class NewPicSearch extends plugin { for (let i of res) { await e.reply(i) } + return true }) .catch(err => common.handleException(e, err)) } diff --git a/apps/pixiv.js b/apps/pixiv.js index 56e282a..934920d 100644 --- a/apps/pixiv.js +++ b/apps/pixiv.js @@ -91,7 +91,7 @@ export class NewPixiv extends plugin { await Pixiv.illust(regRet[1], filter) .then(async res => { await e.reply(res.msg) - res.img.length == 1 ? common.recallsendMsg(e, res.img) : common.recallSendForwardMsg(e, res.img, false) + return res.img.length == 1 ? common.recallsendMsg(e, res.img) : common.recallSendForwardMsg(e, res.img, false) }) .catch(err => common.handleException(e, err)) } @@ -221,11 +221,10 @@ export class NewPixiv extends plugin { if (!await this._Authentication(e, 'sese')) return e.reply(Pixiv.startMsg) let num = e.msg.match(/\d+/) || 1 - await Pixiv.illustRecommended(num).then(res => { - res.length == 1 - ? common.recallsendMsg(e, res[0], true) - : common.recallSendForwardMsg(e, res) - }).catch(err => common.handleException(e, err)) + await Pixiv.illustRecommended(num).then(res => res.length == 1 + ? common.recallsendMsg(e, res[0], true) + : common.recallSendForwardMsg(e, res) + ).catch(err => common.handleException(e, err)) } // 更换代理 diff --git a/apps/state.js b/apps/state.js index 12679fc..bc6c024 100644 --- a/apps/state.js +++ b/apps/state.js @@ -44,7 +44,6 @@ export class NewState extends plugin { // 防止多次触发 if (interval) { return false } else interval = true // 系统 - let FastFetch; let HardDisk let otherInfo = [] // 其他信息 otherInfo.push({ @@ -56,8 +55,8 @@ export class NewState extends plugin { // 插件数量 otherInfo.push(State.getPluginNum) let promiseTaskList = [ - State.getFastFetch(e).then(res => { FastFetch = res }), - State.getFsSize().then(res => { HardDisk = res }) + State.getFastFetch(e), + State.getFsSize() ] // 网络测试 @@ -69,7 +68,7 @@ export class NewState extends plugin { tail: res })))) // 执行promise任务 - await Promise.all(promiseTaskList) + let [FastFetch, HardDisk] = await Promise.all(promiseTaskList) // 可视化数据 let visualData = _.compact(await Promise.all([ // CPU板块 diff --git a/package.json b/package.json index 901b63f..bbca59c 100644 --- a/package.json +++ b/package.json @@ -31,11 +31,13 @@ "eslint-config-standard": "^17.1.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jsdoc": "^48.2.1", - "eslint-plugin-n": "^16.6.2", "eslint-plugin-promise": "^6.1.1", "husky": "^9.0.11", "lint-staged": "^15.2.2" }, + "optionalDependencies": { + "abort-controller": "^3.0.0" + }, "lint-staged": { "*.js": [ "eslint --fix"