@karinjs/adapter-qqbot 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { c as pluginDirName, n as config } from "./config-D1_LqrcJ.js";
1
+ import { c as pluginDirName, n as config } from "./config-BgCU6apn.js";
2
2
  import { t as log } from "./logger-sza6kuy3.js";
3
3
  import { karinPathBase, karinPathTemp } from "node-karin";
4
4
  import { createWriteStream } from "node:fs";
@@ -0,0 +1,5 @@
1
+ import "./config-BgCU6apn.js";
2
+ import "./logger-sza6kuy3.js";
3
+ import "./common-DwVsAvIo.js";
4
+
5
+ export { };
@@ -6,7 +6,6 @@ type WebQQBotInput = {
6
6
  guildEnable: unknown;
7
7
  guildMode: unknown;
8
8
  regex: unknown;
9
- 'markdown:enable': unknown;
10
9
  'messageCache:enable': unknown;
11
10
  'messageCache:self': unknown;
12
11
  'messageCache:level': unknown;
@@ -1,5 +1,5 @@
1
- import { a as readConfigFile, n as config, o as writeConfig, s as pkg } from "./config-D1_LqrcJ.js";
2
- import "./utils-QpIUJhxK.js";
1
+ import { a as readConfigFile, n as config, o as writeConfig, s as pkg } from "./config-BgCU6apn.js";
2
+ import "./utils-u17tvC2U.js";
3
3
  import karin, { components, defineConfig } from "node-karin";
4
4
 
5
5
  //#region src/web.config.ts
@@ -71,7 +71,6 @@ var web_config_default = defineConfig({
71
71
  guildEnable: item.guildEnable,
72
72
  guildMode: item.guildMode === 1,
73
73
  regex: item.regex.map((r) => `${r.reg} ${r.rep}`),
74
- "markdown:enable": item.markdown?.enable !== false,
75
74
  "messageCache:enable": item.messageCache?.enable === true,
76
75
  "messageCache:self": item.messageCache?.self === true,
77
76
  "messageCache:level": item.messageCache?.level || "standard",
@@ -84,7 +83,7 @@ var web_config_default = defineConfig({
84
83
  descPosition: 5
85
84
  }), components.accordionPro.create("qqbot", data, {
86
85
  label: "QQ 官方机器人列表",
87
- description: "每一项对应一个 QQ 官方机器人账号。新增机器人时先填 AppID 和 Secret,再按需调整接收方式、场景能力和发送能力。",
86
+ description: "每一项对应一个 QQ 官方机器人账号。新增机器人时先填 AppID 和 Secret,再按需调整接收方式、场景能力和消息处理。",
88
87
  children: {
89
88
  key: "qqbotConfig",
90
89
  children: [
@@ -144,7 +143,7 @@ var web_config_default = defineConfig({
144
143
  defaultSelected: false
145
144
  }),
146
145
  components.divider.horizontal("bot-message-section", {
147
- description: "消息发送",
146
+ description: "消息处理",
148
147
  descPosition: 5
149
148
  }),
150
149
  components.input.group("regex", {
@@ -156,11 +155,6 @@ var web_config_default = defineConfig({
156
155
  placeholder: "^/ #"
157
156
  })
158
157
  }),
159
- components.switch.create("markdown:enable", {
160
- label: "启用 Markdown 发送通道",
161
- description: "开启后普通文本和图片优先合并为 QQ Markdown 消息,Markdown 里的图片会以内嵌图片形式发送;关闭后普通图片会按官方富媒体单独上传发送。插件显式传入的 segment.markdown 不受此开关影响。",
162
- defaultSelected: true
163
- }),
164
158
  components.divider.horizontal("bot-cache-section", {
165
159
  description: "消息缓存",
166
160
  descPosition: 5
@@ -223,7 +217,6 @@ var web_config_default = defineConfig({
223
217
  const guildEnable = toBool(item.guildEnable, previous?.guildEnable ?? true);
224
218
  const guildMode = toBool(item.guildMode, previous?.guildMode === 1) ? 1 : 0;
225
219
  const eventType = Number(toStringValue(item["event:type"], String(previous?.event?.type ?? 0)));
226
- const markdownEnable = toBool(item["markdown:enable"], previous?.markdown?.enable ?? true);
227
220
  const messageCacheEnable = toBool(item["messageCache:enable"], previous?.messageCache?.enable ?? false);
228
221
  const messageCacheSelf = toBool(item["messageCache:self"], previous?.messageCache?.self ?? false);
229
222
  /** 枚举与数值范围由 writeConfig 内的 formatConfig 统一校验回落。 */
@@ -247,7 +240,6 @@ var web_config_default = defineConfig({
247
240
  guildEnable,
248
241
  guildMode,
249
242
  regex,
250
- markdown: { enable: markdownEnable },
251
243
  messageCache: {
252
244
  enable: messageCacheEnable,
253
245
  self: messageCacheSelf,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karinjs/adapter-qqbot",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "karin adapter for QQ Official Bot (2.0)",
5
5
  "homepage": "https://github.com/KarinJS/karin-plugin-adapter-qqbot",
6
6
  "bugs": {
@@ -21,12 +21,13 @@
21
21
  "build": "tsc && tsdown",
22
22
  "dev": "tsx watch --include \"src/**/*.ts\" src/app.ts",
23
23
  "karin": "karin",
24
- "lint": "eslint src",
25
- "lint:fix": "eslint src --fix",
24
+ "lint": "eslint src tests",
25
+ "lint:fix": "eslint src tests --fix",
26
26
  "pub": "npm publish --access public",
27
27
  "sort": "npx sort-package-json",
28
- "test": "node tests/schema-sql.test.mjs && node tests/codec.test.mjs && node tests/store.test.mjs",
29
- "typecheck": "npx tsc --noEmit"
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "typecheck": "npx tsc --noEmit && npx tsc --noEmit -p tests/tsconfig.json"
30
31
  },
31
32
  "dependencies": {
32
33
  "@karinjs/geturls": "^1.0.2",
@@ -46,7 +47,8 @@
46
47
  "node-karin": "1.16.3",
47
48
  "tsdown": "^0.22.13",
48
49
  "tsx": "^4.23.1",
49
- "typescript": "^6.0.3"
50
+ "typescript": "^6.0.3",
51
+ "vitest": "^4.1.11"
50
52
  },
51
53
  "publishConfig": {
52
54
  "access": "public",
@@ -1,32 +0,0 @@
1
- import "./config-D1_LqrcJ.js";
2
- import "./logger-sza6kuy3.js";
3
- import { common, logger } from "node-karin";
4
- import qrcode from "qrcode";
5
- import size from "image-size";
6
- import lodash from "node-karin/lodash";
7
- import "@karinjs/geturls";
8
-
9
- //#region src/utils/common.ts
10
- /** QQBot统一API地址 */
11
- const QQAPIBASEURL = "https://api.bot.qq.com";
12
- /** 随机数 */
13
- const random = (min, max) => lodash.random(min, max);
14
- /**
15
- * 伪事件日志(红字)
16
- */
17
- const fakeEvent = (log) => {
18
- logger.fatal(`${logger.red("[QQ Official Bot][虚假事件]")} ${log.replace(/\n/g, "\\n")}`);
19
- };
20
- /**
21
- * 读取图片宽高
22
- */
23
- const getImageSize = async (url) => {
24
- const { width = 100, height = 100 } = size(await common.buffer(url));
25
- return {
26
- width,
27
- height
28
- };
29
- };
30
-
31
- //#endregion
32
- export { random as i, fakeEvent as n, getImageSize as r, QQAPIBASEURL as t };