koishi-plugin-bilibili-notify 3.3.4-alpha.3 → 3.3.5-alpha.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.
package/lib/index.js CHANGED
@@ -35,7 +35,6 @@ const cron = __toESM(require("cron"));
35
35
  const luxon = __toESM(require("luxon"));
36
36
  const __node_rs_jieba = __toESM(require("@node-rs/jieba"));
37
37
  const __node_rs_jieba_dict = __toESM(require("@node-rs/jieba/dict"));
38
- const __satorijs_element_jsx_runtime = __toESM(require("@satorijs/element/jsx-runtime"));
39
38
  require("koishi-plugin-puppeteer");
40
39
  const node_path = __toESM(require("node:path"));
41
40
  const node_url = __toESM(require("node:url"));
@@ -46,7 +45,7 @@ const node_https = __toESM(require("node:https"));
46
45
  const axios = __toESM(require("axios"));
47
46
  const tough_cookie = __toESM(require("tough-cookie"));
48
47
  const jsdom = __toESM(require("jsdom"));
49
- const __akokko_blive_message_listener = __toESM(require("@akokko/blive-message-listener"));
48
+ const blive_message_listener = __toESM(require("blive-message-listener"));
50
49
 
51
50
  //#region src/config.ts
52
51
  const BAConfigSchema = koishi.Schema.object({
@@ -341,7 +340,7 @@ const stopwords = new Set([
341
340
  var stop_words_default = stopwords;
342
341
 
343
342
  //#endregion
344
- //#region src/command_register.tsx
343
+ //#region src/command_register.ts
345
344
  var ComRegister = class {
346
345
  static inject = [
347
346
  "bilibili-notify",
@@ -623,7 +622,7 @@ var ComRegister = class {
623
622
  ["田七", 25]
624
623
  ];
625
624
  const summary = this.config.liveSummary.join("\n").replace("-dmc", "114").replace("-mdn", "特工").replace("-dca", "514").replace("-un1", `${top5DanmakuMaker[0][0]}`).replace("-dc1", `${top5DanmakuMaker[0][1]}`).replace("-un2", `${top5DanmakuMaker[1][0]}`).replace("-dc2", `${top5DanmakuMaker[1][1]}`).replace("-un3", `${top5DanmakuMaker[2][0]}`).replace("-dc3", `${top5DanmakuMaker[2][1]}`).replace("-un4", `${top5DanmakuMaker[3][0]}`).replace("-dc4", `${top5DanmakuMaker[3][1]}`).replace("-un5", `${top5DanmakuMaker[4][0]}`).replace("-dc5", `${top5DanmakuMaker[4][1]}`).replaceAll("\\n", "\n");
626
- await session.send(/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [img, summary] }));
625
+ await session.send((0, koishi.h)("message", [img, koishi.h.text(summary)]));
627
626
  });
628
627
  biliCom.subcommand(".cap").action(async ({ session }) => {
629
628
  const { code: userInfoCode, data: userInfoData } = await withRetry(async () => {
@@ -909,7 +908,7 @@ var ComRegister = class {
909
908
  this.logger.info(record.liveAtAllArr);
910
909
  const atAllArr = structuredClone(record.liveAtAllArr);
911
910
  await withRetry(async () => {
912
- return await this.pushMessage(atAllArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("at", { type: "all" }) }));
911
+ return await this.pushMessage(atAllArr, koishi.h.at("all"));
913
912
  }, 1);
914
913
  }
915
914
  if (type === PushType.Dynamic && record.dynamicArr?.length >= 1) {
@@ -917,27 +916,27 @@ var ComRegister = class {
917
916
  this.logger.info(record.dynamicAtAllArr);
918
917
  const dynamicAtAllArr = structuredClone(record.dynamicAtAllArr);
919
918
  await withRetry(async () => {
920
- return await this.pushMessage(dynamicAtAllArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("at", { type: "all" }) }));
919
+ return await this.pushMessage(dynamicAtAllArr, koishi.h.at("all"));
921
920
  }, 1);
922
921
  }
923
922
  this.logger.info(record.dynamicArr);
924
923
  const dynamicArr = structuredClone(record.dynamicArr);
925
924
  await withRetry(async () => {
926
- return await this.pushMessage(dynamicArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
925
+ return await this.pushMessage(dynamicArr, (0, koishi.h)("message", content));
927
926
  }, 1);
928
927
  }
929
928
  if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length >= 1) {
930
929
  this.logger.info(record.liveArr);
931
930
  const liveArr = structuredClone(record.liveArr);
932
931
  await withRetry(async () => {
933
- return await this.pushMessage(liveArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
932
+ return await this.pushMessage(liveArr, (0, koishi.h)("message", content));
934
933
  }, 1);
935
934
  }
936
935
  if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length >= 1) {
937
936
  this.logger.info(record.liveGuardBuyArr);
938
937
  const liveGuardBuyArr = structuredClone(record.liveGuardBuyArr);
939
938
  await withRetry(async () => {
940
- return await this.pushMessage(liveGuardBuyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
939
+ return await this.pushMessage(liveGuardBuyArr, (0, koishi.h)(koishi.h.Fragment, (0, koishi.h)(content)));
941
940
  }, 1);
942
941
  }
943
942
  if (type === PushType.WordCloudAndLiveSummary) {
@@ -950,21 +949,21 @@ var ComRegister = class {
950
949
  this.logger.info("词云和直播总结");
951
950
  this.logger.info(wordcloudAndLiveSummaryArr);
952
951
  await withRetry(async () => {
953
- return await this.pushMessage(wordcloudAndLiveSummaryArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [content[0], content[1]] }));
952
+ return await this.pushMessage(wordcloudAndLiveSummaryArr, (0, koishi.h)("message", [content[0], content[1]]));
954
953
  }, 1);
955
954
  }
956
955
  if (wordcloudOnlyArr.length > 0) {
957
956
  this.logger.info("词云");
958
957
  this.logger.info(wordcloudOnlyArr);
959
958
  await withRetry(async () => {
960
- return await this.pushMessage(wordcloudOnlyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content[0] }));
959
+ return await this.pushMessage(wordcloudOnlyArr, (0, koishi.h)("message", [content[0]]));
961
960
  }, 1);
962
961
  }
963
962
  if (liveSummaryOnlyArr.length > 0) {
964
963
  this.logger.info("直播总结");
965
964
  this.logger.info(liveSummaryOnlyArr);
966
965
  await withRetry(async () => {
967
- return await this.pushMessage(liveSummaryOnlyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content[1] }));
966
+ return await this.pushMessage(liveSummaryOnlyArr, (0, koishi.h)("message", [content[1]]));
968
967
  }, 1);
969
968
  }
970
969
  }
@@ -1013,15 +1012,15 @@ var ComRegister = class {
1013
1012
  }, 1).catch(async (e) => {
1014
1013
  if (e.message === "直播开播动态,不做处理") return;
1015
1014
  if (e.message === "出现关键词,屏蔽该动态") {
1016
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
1015
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}发布了一条含有屏蔽关键字的动态`), PushType.Dynamic);
1017
1016
  return;
1018
1017
  }
1019
1018
  if (e.message === "已屏蔽转发动态") {
1020
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
1019
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}转发了一条动态,已屏蔽`), PushType.Dynamic);
1021
1020
  return;
1022
1021
  }
1023
1022
  if (e.message === "已屏蔽专栏动态") {
1024
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1023
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}投稿了一条专栏,已屏蔽`), PushType.Dynamic);
1025
1024
  return;
1026
1025
  }
1027
1026
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
@@ -1035,18 +1034,12 @@ var ComRegister = class {
1035
1034
  } else dUrl = `${name$2}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
1036
1035
  else dUrl = `${name$2}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
1037
1036
  this.logger.info("推送动态中...");
1038
- await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1037
+ await this.broadcastToTargets(uid, (0, koishi.h)("message", [koishi.h.image(buffer, "image/jpeg"), koishi.h.text(dUrl)]), PushType.Dynamic);
1039
1038
  if (this.config.pushImgsInDynamic) {
1040
1039
  if (item.type === "DYNAMIC_TYPE_DRAW") {
1041
1040
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
1042
1041
  if (pics) {
1043
- const picsMsg = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", {
1044
- forward: true,
1045
- children: pics.map((pic) => /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("img", {
1046
- src: pic.url,
1047
- alt: "动态图片"
1048
- }, pic.url))
1049
- });
1042
+ const picsMsg = (0, koishi.h)("message", { forward: true }, pics.map((pic) => koishi.h.img(pic.url)));
1050
1043
  await this.broadcastToTargets(uid, picsMsg, PushType.Dynamic);
1051
1044
  }
1052
1045
  }
@@ -1114,15 +1107,15 @@ var ComRegister = class {
1114
1107
  }, 1).catch(async (e) => {
1115
1108
  if (e.message === "直播开播动态,不做处理") return;
1116
1109
  if (e.message === "出现关键词,屏蔽该动态") {
1117
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
1110
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}发布了一条含有屏蔽关键字的动态`), PushType.Dynamic);
1118
1111
  return;
1119
1112
  }
1120
1113
  if (e.message === "已屏蔽转发动态") {
1121
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
1114
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}转发了一条动态,已屏蔽`), PushType.Dynamic);
1122
1115
  return;
1123
1116
  }
1124
1117
  if (e.message === "已屏蔽专栏动态") {
1125
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1118
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, (0, koishi.h)("message", `${name$2}投稿了一条专栏,已屏蔽`), PushType.Dynamic);
1126
1119
  return;
1127
1120
  }
1128
1121
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
@@ -1141,19 +1134,13 @@ var ComRegister = class {
1141
1134
  this.logger.info("动态链接生成成功!");
1142
1135
  }
1143
1136
  this.logger.info("推送动态中...");
1144
- await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1137
+ await this.broadcastToTargets(uid, (0, koishi.h)("message", [koishi.h.image(buffer, "image/jpeg"), koishi.h.text(dUrl)]), PushType.Dynamic);
1145
1138
  if (this.config.pushImgsInDynamic) {
1146
1139
  this.logger.info("需要发送动态中的图片,开始发送...");
1147
1140
  if (item.type === "DYNAMIC_TYPE_DRAW") {
1148
1141
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
1149
1142
  if (pics) {
1150
- const picsMsg = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", {
1151
- forward: true,
1152
- children: pics.map((pic) => /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("img", {
1153
- src: pic.url,
1154
- alt: "动态图片"
1155
- }, pic.url))
1156
- });
1143
+ const picsMsg = (0, koishi.h)("message", { forward: true }, pics.map((pic) => koishi.h.img(pic.url)));
1157
1144
  await this.broadcastToTargets(uid, picsMsg, PushType.Dynamic);
1158
1145
  }
1159
1146
  }
@@ -1214,7 +1201,7 @@ var ComRegister = class {
1214
1201
  this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e.message}`);
1215
1202
  });
1216
1203
  if (!buffer) return await this.sendPrivateMsgAndStopService();
1217
- const msg = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] });
1204
+ const msg = (0, koishi.h)("message", [koishi.h.image(buffer, "image/jpeg"), koishi.h.text(liveNotifyMsg || "")]);
1218
1205
  return await this.broadcastToTargets(uid, msg, liveType === LiveType.StartBroadcasting ? PushType.StartBroadcasting : PushType.Live);
1219
1206
  }
1220
1207
  async segmentDanmaku(danmaku, danmakuWeightRecord) {
@@ -1319,15 +1306,7 @@ var ComRegister = class {
1319
1306
  watchedNum = body.text_small;
1320
1307
  },
1321
1308
  onGuardBuy: ({ body }) => {
1322
- const content = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [
1323
- "【",
1324
- masterInfo.username,
1325
- "的直播间】",
1326
- body.user.uname,
1327
- "加入了大航海(",
1328
- body.gift_name,
1329
- ")"
1330
- ] });
1309
+ const content = (0, koishi.h)("message", [koishi.h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`)]);
1331
1310
  this.broadcastToTargets(sub.uid, content, PushType.LiveGuardBuy);
1332
1311
  },
1333
1312
  onLiveStart: async () => {
@@ -1536,7 +1515,7 @@ var ComRegister = class {
1536
1515
  else {
1537
1516
  const subTableArray = subInfo.split("\n");
1538
1517
  subTableArray.splice(subTableArray.length - 1, 1);
1539
- table = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)(__satorijs_element_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("p", { children: "当前订阅对象:" }), /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("ul", { children: subTableArray.map((str) => /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("li", { children: str })) })] });
1518
+ table = (0, koishi.h)(koishi.h.Fragment, [(0, koishi.h)("p", "当前订阅对象:"), (0, koishi.h)("ul", subTableArray.map((str) => (0, koishi.h)("li", str)))]);
1540
1519
  }
1541
1520
  this.subNotifier = this.ctx.notifier.create(table);
1542
1521
  }
@@ -4115,7 +4094,7 @@ var BLive = class extends koishi.Service {
4115
4094
  async startLiveRoomListener(roomId, handler) {
4116
4095
  const cookiesStr = await this.ctx["bilibili-notify-api"].getCookiesForHeader();
4117
4096
  const mySelfInfo = await this.ctx["bilibili-notify-api"].getMyselfInfo();
4118
- this.listenerRecord[roomId] = (0, __akokko_blive_message_listener.startListen)(Number.parseInt(roomId), handler, { ws: {
4097
+ this.listenerRecord[roomId] = (0, blive_message_listener.startListen)(Number.parseInt(roomId), handler, { ws: {
4119
4098
  headers: { Cookie: cookiesStr },
4120
4099
  uid: mySelfInfo.data.mid
4121
4100
  } });
package/lib/index.mjs CHANGED
@@ -6,7 +6,6 @@ import { CronJob } from "cron";
6
6
  import { DateTime } from "luxon";
7
7
  import { Jieba } from "@node-rs/jieba";
8
8
  import { dict } from "@node-rs/jieba/dict";
9
- import { Fragment, jsx, jsxs } from "@satorijs/element/jsx-runtime";
10
9
  import "koishi-plugin-puppeteer";
11
10
  import { resolve } from "node:path";
12
11
  import { pathToFileURL } from "node:url";
@@ -17,7 +16,7 @@ import https from "node:https";
17
16
  import axios from "axios";
18
17
  import { Cookie, CookieJar } from "tough-cookie";
19
18
  import { JSDOM } from "jsdom";
20
- import { startListen } from "@akokko/blive-message-listener";
19
+ import { startListen } from "blive-message-listener";
21
20
 
22
21
  //#region rolldown:runtime
23
22
  var __defProp = Object.defineProperty;
@@ -322,7 +321,7 @@ const stopwords = new Set([
322
321
  var stop_words_default = stopwords;
323
322
 
324
323
  //#endregion
325
- //#region src/command_register.tsx
324
+ //#region src/command_register.ts
326
325
  var ComRegister = class {
327
326
  static inject = [
328
327
  "bilibili-notify",
@@ -604,7 +603,7 @@ var ComRegister = class {
604
603
  ["田七", 25]
605
604
  ];
606
605
  const summary = this.config.liveSummary.join("\n").replace("-dmc", "114").replace("-mdn", "特工").replace("-dca", "514").replace("-un1", `${top5DanmakuMaker[0][0]}`).replace("-dc1", `${top5DanmakuMaker[0][1]}`).replace("-un2", `${top5DanmakuMaker[1][0]}`).replace("-dc2", `${top5DanmakuMaker[1][1]}`).replace("-un3", `${top5DanmakuMaker[2][0]}`).replace("-dc3", `${top5DanmakuMaker[2][1]}`).replace("-un4", `${top5DanmakuMaker[3][0]}`).replace("-dc4", `${top5DanmakuMaker[3][1]}`).replace("-un5", `${top5DanmakuMaker[4][0]}`).replace("-dc5", `${top5DanmakuMaker[4][1]}`).replaceAll("\\n", "\n");
607
- await session.send(/* @__PURE__ */ jsxs("message", { children: [img, summary] }));
606
+ await session.send(h("message", [img, h.text(summary)]));
608
607
  });
609
608
  biliCom.subcommand(".cap").action(async ({ session }) => {
610
609
  const { code: userInfoCode, data: userInfoData } = await withRetry(async () => {
@@ -890,7 +889,7 @@ var ComRegister = class {
890
889
  this.logger.info(record.liveAtAllArr);
891
890
  const atAllArr = structuredClone(record.liveAtAllArr);
892
891
  await withRetry(async () => {
893
- return await this.pushMessage(atAllArr, /* @__PURE__ */ jsx("message", { children: /* @__PURE__ */ jsx("at", { type: "all" }) }));
892
+ return await this.pushMessage(atAllArr, h.at("all"));
894
893
  }, 1);
895
894
  }
896
895
  if (type === PushType.Dynamic && record.dynamicArr?.length >= 1) {
@@ -898,27 +897,27 @@ var ComRegister = class {
898
897
  this.logger.info(record.dynamicAtAllArr);
899
898
  const dynamicAtAllArr = structuredClone(record.dynamicAtAllArr);
900
899
  await withRetry(async () => {
901
- return await this.pushMessage(dynamicAtAllArr, /* @__PURE__ */ jsx("message", { children: /* @__PURE__ */ jsx("at", { type: "all" }) }));
900
+ return await this.pushMessage(dynamicAtAllArr, h.at("all"));
902
901
  }, 1);
903
902
  }
904
903
  this.logger.info(record.dynamicArr);
905
904
  const dynamicArr = structuredClone(record.dynamicArr);
906
905
  await withRetry(async () => {
907
- return await this.pushMessage(dynamicArr, /* @__PURE__ */ jsx("message", { children: content }));
906
+ return await this.pushMessage(dynamicArr, h("message", content));
908
907
  }, 1);
909
908
  }
910
909
  if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length >= 1) {
911
910
  this.logger.info(record.liveArr);
912
911
  const liveArr = structuredClone(record.liveArr);
913
912
  await withRetry(async () => {
914
- return await this.pushMessage(liveArr, /* @__PURE__ */ jsx("message", { children: content }));
913
+ return await this.pushMessage(liveArr, h("message", content));
915
914
  }, 1);
916
915
  }
917
916
  if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length >= 1) {
918
917
  this.logger.info(record.liveGuardBuyArr);
919
918
  const liveGuardBuyArr = structuredClone(record.liveGuardBuyArr);
920
919
  await withRetry(async () => {
921
- return await this.pushMessage(liveGuardBuyArr, /* @__PURE__ */ jsx("message", { children: content }));
920
+ return await this.pushMessage(liveGuardBuyArr, h(h.Fragment, h(content)));
922
921
  }, 1);
923
922
  }
924
923
  if (type === PushType.WordCloudAndLiveSummary) {
@@ -931,21 +930,21 @@ var ComRegister = class {
931
930
  this.logger.info("词云和直播总结");
932
931
  this.logger.info(wordcloudAndLiveSummaryArr);
933
932
  await withRetry(async () => {
934
- return await this.pushMessage(wordcloudAndLiveSummaryArr, /* @__PURE__ */ jsxs("message", { children: [content[0], content[1]] }));
933
+ return await this.pushMessage(wordcloudAndLiveSummaryArr, h("message", [content[0], content[1]]));
935
934
  }, 1);
936
935
  }
937
936
  if (wordcloudOnlyArr.length > 0) {
938
937
  this.logger.info("词云");
939
938
  this.logger.info(wordcloudOnlyArr);
940
939
  await withRetry(async () => {
941
- return await this.pushMessage(wordcloudOnlyArr, /* @__PURE__ */ jsx("message", { children: content[0] }));
940
+ return await this.pushMessage(wordcloudOnlyArr, h("message", [content[0]]));
942
941
  }, 1);
943
942
  }
944
943
  if (liveSummaryOnlyArr.length > 0) {
945
944
  this.logger.info("直播总结");
946
945
  this.logger.info(liveSummaryOnlyArr);
947
946
  await withRetry(async () => {
948
- return await this.pushMessage(liveSummaryOnlyArr, /* @__PURE__ */ jsx("message", { children: content[1] }));
947
+ return await this.pushMessage(liveSummaryOnlyArr, h("message", [content[1]]));
949
948
  }, 1);
950
949
  }
951
950
  }
@@ -994,15 +993,15 @@ var ComRegister = class {
994
993
  }, 1).catch(async (e) => {
995
994
  if (e.message === "直播开播动态,不做处理") return;
996
995
  if (e.message === "出现关键词,屏蔽该动态") {
997
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ jsxs("message", { children: [name$2, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
996
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, h("message", `${name$2}发布了一条含有屏蔽关键字的动态`), PushType.Dynamic);
998
997
  return;
999
998
  }
1000
999
  if (e.message === "已屏蔽转发动态") {
1001
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ jsxs("message", { children: [name$2, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
1000
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, h("message", `${name$2}转发了一条动态,已屏蔽`), PushType.Dynamic);
1002
1001
  return;
1003
1002
  }
1004
1003
  if (e.message === "已屏蔽专栏动态") {
1005
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ jsxs("message", { children: [name$2, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1004
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, h("message", `${name$2}投稿了一条专栏,已屏蔽`), PushType.Dynamic);
1006
1005
  return;
1007
1006
  }
1008
1007
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
@@ -1016,18 +1015,12 @@ var ComRegister = class {
1016
1015
  } else dUrl = `${name$2}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
1017
1016
  else dUrl = `${name$2}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
1018
1017
  this.logger.info("推送动态中...");
1019
- await this.broadcastToTargets(uid, /* @__PURE__ */ jsxs("message", { children: [h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1018
+ await this.broadcastToTargets(uid, h("message", [h.image(buffer, "image/jpeg"), h.text(dUrl)]), PushType.Dynamic);
1020
1019
  if (this.config.pushImgsInDynamic) {
1021
1020
  if (item.type === "DYNAMIC_TYPE_DRAW") {
1022
1021
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
1023
1022
  if (pics) {
1024
- const picsMsg = /* @__PURE__ */ jsx("message", {
1025
- forward: true,
1026
- children: pics.map((pic) => /* @__PURE__ */ jsx("img", {
1027
- src: pic.url,
1028
- alt: "动态图片"
1029
- }, pic.url))
1030
- });
1023
+ const picsMsg = h("message", { forward: true }, pics.map((pic) => h.img(pic.url)));
1031
1024
  await this.broadcastToTargets(uid, picsMsg, PushType.Dynamic);
1032
1025
  }
1033
1026
  }
@@ -1095,15 +1088,15 @@ var ComRegister = class {
1095
1088
  }, 1).catch(async (e) => {
1096
1089
  if (e.message === "直播开播动态,不做处理") return;
1097
1090
  if (e.message === "出现关键词,屏蔽该动态") {
1098
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ jsxs("message", { children: [name$2, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
1091
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, h("message", `${name$2}发布了一条含有屏蔽关键字的动态`), PushType.Dynamic);
1099
1092
  return;
1100
1093
  }
1101
1094
  if (e.message === "已屏蔽转发动态") {
1102
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ jsxs("message", { children: [name$2, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
1095
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, h("message", `${name$2}转发了一条动态,已屏蔽`), PushType.Dynamic);
1103
1096
  return;
1104
1097
  }
1105
1098
  if (e.message === "已屏蔽专栏动态") {
1106
- if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ jsxs("message", { children: [name$2, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1099
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, h("message", `${name$2}投稿了一条专栏,已屏蔽`), PushType.Dynamic);
1107
1100
  return;
1108
1101
  }
1109
1102
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
@@ -1122,19 +1115,13 @@ var ComRegister = class {
1122
1115
  this.logger.info("动态链接生成成功!");
1123
1116
  }
1124
1117
  this.logger.info("推送动态中...");
1125
- await this.broadcastToTargets(uid, /* @__PURE__ */ jsxs("message", { children: [h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1118
+ await this.broadcastToTargets(uid, h("message", [h.image(buffer, "image/jpeg"), h.text(dUrl)]), PushType.Dynamic);
1126
1119
  if (this.config.pushImgsInDynamic) {
1127
1120
  this.logger.info("需要发送动态中的图片,开始发送...");
1128
1121
  if (item.type === "DYNAMIC_TYPE_DRAW") {
1129
1122
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
1130
1123
  if (pics) {
1131
- const picsMsg = /* @__PURE__ */ jsx("message", {
1132
- forward: true,
1133
- children: pics.map((pic) => /* @__PURE__ */ jsx("img", {
1134
- src: pic.url,
1135
- alt: "动态图片"
1136
- }, pic.url))
1137
- });
1124
+ const picsMsg = h("message", { forward: true }, pics.map((pic) => h.img(pic.url)));
1138
1125
  await this.broadcastToTargets(uid, picsMsg, PushType.Dynamic);
1139
1126
  }
1140
1127
  }
@@ -1195,7 +1182,7 @@ var ComRegister = class {
1195
1182
  this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e.message}`);
1196
1183
  });
1197
1184
  if (!buffer) return await this.sendPrivateMsgAndStopService();
1198
- const msg = /* @__PURE__ */ jsxs("message", { children: [h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] });
1185
+ const msg = h("message", [h.image(buffer, "image/jpeg"), h.text(liveNotifyMsg || "")]);
1199
1186
  return await this.broadcastToTargets(uid, msg, liveType === LiveType.StartBroadcasting ? PushType.StartBroadcasting : PushType.Live);
1200
1187
  }
1201
1188
  async segmentDanmaku(danmaku, danmakuWeightRecord) {
@@ -1300,15 +1287,7 @@ var ComRegister = class {
1300
1287
  watchedNum = body.text_small;
1301
1288
  },
1302
1289
  onGuardBuy: ({ body }) => {
1303
- const content = /* @__PURE__ */ jsxs("message", { children: [
1304
- "【",
1305
- masterInfo.username,
1306
- "的直播间】",
1307
- body.user.uname,
1308
- "加入了大航海(",
1309
- body.gift_name,
1310
- ")"
1311
- ] });
1290
+ const content = h("message", [h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`)]);
1312
1291
  this.broadcastToTargets(sub.uid, content, PushType.LiveGuardBuy);
1313
1292
  },
1314
1293
  onLiveStart: async () => {
@@ -1517,7 +1496,7 @@ var ComRegister = class {
1517
1496
  else {
1518
1497
  const subTableArray = subInfo.split("\n");
1519
1498
  subTableArray.splice(subTableArray.length - 1, 1);
1520
- table = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", { children: "当前订阅对象:" }), /* @__PURE__ */ jsx("ul", { children: subTableArray.map((str) => /* @__PURE__ */ jsx("li", { children: str })) })] });
1499
+ table = h(h.Fragment, [h("p", "当前订阅对象:"), h("ul", subTableArray.map((str) => h("li", str)))]);
1521
1500
  }
1522
1501
  this.subNotifier = this.ctx.notifier.create(table);
1523
1502
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "3.3.4-alpha.3",
4
+ "version": "3.3.5-alpha.0",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -28,12 +28,12 @@
28
28
  "build": "tsdown"
29
29
  },
30
30
  "dependencies": {
31
- "@akokko/blive-message-listener": "^0.5.1",
32
31
  "@node-rs/jieba": "^2.0.1",
33
32
  "axios": "^1.11.0",
34
33
  "axios-cookiejar-support": "^6.0.4",
34
+ "blive-message-listener": "^0.5.1",
35
35
  "cacheable-lookup": "^7.0.0",
36
- "cron": "^4.3.2",
36
+ "cron": "^4.3.3",
37
37
  "jsdom": "^26.1.0",
38
38
  "luxon": "^3.7.1",
39
39
  "md5": "^2.3.0",
@@ -43,12 +43,12 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/jsdom": "^21.1.7",
46
- "@types/luxon": "^3.6.2",
46
+ "@types/luxon": "^3.7.1",
47
47
  "@types/md5": "^2.3.5",
48
48
  "@types/qrcode": "^1.5.5",
49
49
  "@types/tough-cookie": "^4.0.5",
50
50
  "koishi-plugin-puppeteer": "^3.9.0",
51
- "tsdown": "^0.13.0"
51
+ "tsdown": "^0.13.3"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "koishi": "^4.18.8"
package/readme.md CHANGED
@@ -338,6 +338,8 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
338
338
  > - ver 3.3.4-alpha.1 修复: CI错误;
339
339
  > - ver 3.3.4-alpha.2 修复: 推送消息时发送6000的bug;
340
340
  > - ver 3.3.4-alpha.3 修复: 相同平台多个机器人可能造成消息重复推送、错误信息推送机器人未初始化完毕推送时会报错;
341
+ > - ver 3.3.4-alpha.4 优化:切换依赖 `blive-message-listener` 回官方版本;
342
+ > - ver 3.3.5-alpha.0 重构:用h渲染函数代替jsx;
341
343
 
342
344
  ## 交流群
343
345