diff --git a/.editorconfig b/.editorconfig index 7c19a87..1b6e051 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,7 +1,6 @@ root = true [*] -# EditorConfig 标准配置项 charset = utf-8 indent_size = 2 indent_style = space @@ -10,18 +9,26 @@ insert_final_newline = true end_of_line = lf trim_trailing_whitespace = true max_line_length = off - -# IntelliJ 系列配置项 ij_any_space_before_colon = true ij_any_space_after_colon = true ij_any_keep_indents_on_empty_lines = false + +[{*.cjs,*.js}] +ij_javascript_align_imports = false ij_javascript_use_semicolon_after_statement = false ij_javascript_use_double_quotes = false ij_javascript_enforce_trailing_comma = keep -ij_typescript_use_semicolon_after_statement = false -ij_typescript_use_double_quotes = false -ij_typescript_enforce_trailing_comma = keep +ij_javascript_space_before_method_parentheses = true +ij_javascript_spaces_within_object_literal_braces = true +ij_javascript_indent_chained_calls = true -[*.json] -ij_any_space_before_colon = false +[{*.json,*.json5}] ij_json_keep_trailing_comma = false +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = false +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false diff --git a/.puppeteerrc.cjs b/.puppeteerrc.cjs index ffefdc9..7ea196e 100644 --- a/.puppeteerrc.cjs +++ b/.puppeteerrc.cjs @@ -1,6 +1,6 @@ const os = require('os') -const {existsSync, realpathSync} = require('fs') -const {execSync} = require('child_process') +const { existsSync, realpathSync } = require('fs') +const { execSync } = require('child_process') const arch = os.arch() let skipDownload = false @@ -59,4 +59,4 @@ if (executablePath || arch === 'arm64' || arch === 'aarch64') { skipDownload = true } -module.exports = {skipDownload, executablePath} +module.exports = { skipDownload, executablePath } diff --git a/lib/common/common.js b/lib/common/common.js index 4ad440c..cf82dd7 100644 --- a/lib/common/common.js +++ b/lib/common/common.js @@ -6,10 +6,10 @@ import path from 'node:path' /** * 发送私聊消息,仅给好友发送 - * @param user_id qq号 + * @param userId qq号 * @param msg 消息 */ -async function relpyPrivate(userId, msg) { +async function relpyPrivate (userId, msg) { userId = Number(userId) let friend = Bot.fl.get(userId) @@ -25,7 +25,7 @@ async function relpyPrivate(userId, msg) { * 休眠函数 * @param ms 毫秒 */ -function sleep(ms) { +function sleep (ms) { return new Promise((resolve) => setTimeout(resolve, ms)) } @@ -33,8 +33,9 @@ function sleep(ms) { * 下载保存文件 * @param fileUrl 下载地址 * @param savePath 保存路径 + * @param param */ -async function downFile(fileUrl, savePath, param = {}) { +async function downFile (fileUrl, savePath, param = {}) { try { mkdirs(path.dirname(savePath)) logger.debug(`[下载文件] ${fileUrl}`) @@ -48,7 +49,7 @@ async function downFile(fileUrl, savePath, param = {}) { } } -function mkdirs(dirname) { +function mkdirs (dirname) { if (fs.existsSync(dirname)) { return true } else { @@ -66,9 +67,11 @@ function mkdirs(dirname) { * @param dec 转发描述 * @param msgsscr 转发信息是否伪装 */ -async function makeForwardMsg(e, msg = [], dec = '', msgsscr = false) { +async function makeForwardMsg (e, msg = [], dec = '', msgsscr = false) { - if (!Array.isArray(msg)) msg = [msg] + if (!Array.isArray(msg)) { + msg = [msg] + } let name = msgsscr ? e.sender.card || e.user_id : Bot.nickname let id = msgsscr ? e.user_id : Bot.uin @@ -84,14 +87,15 @@ async function makeForwardMsg(e, msg = [], dec = '', msgsscr = false) { } let forwardMsg = [] - for (const message of msg){ - if(!message) continue + for (const message of msg) { + if (!message) { + continue + } forwardMsg.push({ ...userInfo, message: message }) } - /** 制作转发内容 */ if (e?.group?.makeForwardMsg) { diff --git a/lib/puppeteer/puppeteer.js b/lib/puppeteer/puppeteer.js index 9ca241a..47498bf 100644 --- a/lib/puppeteer/puppeteer.js +++ b/lib/puppeteer/puppeteer.js @@ -25,4 +25,3 @@ export default { return ret.length > 0 ? ret : false } } - diff --git a/lib/renderer/Renderer.js b/lib/renderer/Renderer.js index 4b64b00..d81c904 100644 --- a/lib/renderer/Renderer.js +++ b/lib/renderer/Renderer.js @@ -37,4 +37,3 @@ export default { return rendererBackends[cfg.renderer?.name || 'puppeteer'] } } - diff --git a/lib/tools/command.js b/lib/tools/command.js index 96ae975..7552f93 100644 --- a/lib/tools/command.js +++ b/lib/tools/command.js @@ -1,4 +1,3 @@ - import '../config/init.js' import log4js from 'log4js' import PluginsLoader from '../plugins/loader.js' @@ -49,7 +48,7 @@ class Command { group_id: data.group_id || 826198224, group_name: data.group_name || '测试群', user_id: data.user_id, - user_avatar:`https://q1.qlogo.cn/g?b=qq&s=0&nk=${data.user_id}`, + user_avatar: `https://q1.qlogo.cn/g?b=qq&s=0&nk=${data.user_id}`, anonymous: null, message: [{ type: 'text', text }], raw_message: text,