koishi-plugin-bilibili-notify 3.2.5-alpha.10 → 3.2.5-alpha.12

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
@@ -552,7 +552,7 @@ var ComRegister = class {
552
552
  subManager = [];
553
553
  dynamicTimelineManager = /* @__PURE__ */ new Map();
554
554
  liveStatusManager = /* @__PURE__ */ new Map();
555
- pushRecord = {};
555
+ pushArrMap = /* @__PURE__ */ new Map();
556
556
  loginDBData;
557
557
  privateBot;
558
558
  dynamicJob;
@@ -797,7 +797,6 @@ var ComRegister = class {
797
797
  });
798
798
  }
799
799
  initPushRecord(subs) {
800
- const pushRecord = {};
801
800
  for (const sub of subs) {
802
801
  const atAllArr = [];
803
802
  const dynamicArr = [];
@@ -809,16 +808,15 @@ var ComRegister = class {
809
808
  if (channel.live) liveArr.push(`${platform.platform}:${channel.channelId}`);
810
809
  if (channel.liveGuardBuy) liveGuardBuyArr.push(`${platform.platform}:${channel.channelId}`);
811
810
  }
812
- pushRecord[sub.uid] = {
811
+ this.pushArrMap.set(sub.uid, {
813
812
  atAllArr,
814
813
  dynamicArr,
815
814
  liveArr,
816
815
  liveGuardBuyArr
817
- };
816
+ });
818
817
  }
819
- this.pushRecord = pushRecord;
820
818
  this.logger.info("初始化推送群组/频道信息:");
821
- this.logger.info(this.pushRecord);
819
+ this.logger.info(this.pushArrMap);
822
820
  }
823
821
  checkAllBotsAreReady() {
824
822
  return !this.ctx.bots.some((bot) => bot.status !== koishi.Universal.Status.ONLINE);
@@ -832,15 +830,8 @@ var ComRegister = class {
832
830
  return;
833
831
  }
834
832
  this.logger.info(`本次推送对象:${uid},推送类型:${PushTypeMsg[type]}`);
835
- const record = this.pushRecord[uid];
833
+ const record = this.pushArrMap.get(uid);
836
834
  this.logger.info("本次推送目标:");
837
- {
838
- this.logger.info(record.atAllArr);
839
- const success = await withRetry(async () => {
840
- return await this.ctx.broadcast(record.atAllArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("at", { type: "all" }) }));
841
- }, 1);
842
- this.logger.info(`成功推送全体成员消息群组/频道:${success}`);
843
- }
844
835
  if (type === PushType.StartBroadcasting && record.atAllArr?.length >= 1) {
845
836
  this.logger.info(record.atAllArr);
846
837
  const success = await withRetry(async () => {
@@ -919,15 +910,15 @@ var ComRegister = class {
919
910
  }, 1).catch(async (e$1) => {
920
911
  if (e$1.message === "直播开播动态,不做处理") return;
921
912
  if (e$1.message === "出现关键词,屏蔽该动态") {
922
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}发布了一条含有屏蔽关键字的动态`, PushType.Dynamic);
913
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$3, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
923
914
  return;
924
915
  }
925
916
  if (e$1.message === "已屏蔽转发动态") {
926
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}转发了一条动态,已屏蔽`, PushType.Dynamic);
917
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$3, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
927
918
  return;
928
919
  }
929
920
  if (e$1.message === "已屏蔽专栏动态") {
930
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}投稿了一条专栏,已屏蔽`, PushType.Dynamic);
921
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$3, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
931
922
  return;
932
923
  }
933
924
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e$1.message}`);
@@ -941,7 +932,7 @@ var ComRegister = class {
941
932
  } else dUrl = `${name$3}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
942
933
  else dUrl = `${name$3}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
943
934
  this.logger.info("推送动态中...");
944
- await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)(__satorijs_element_jsx_runtime.Fragment, { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
935
+ await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(buffer, "image/jpeg") }), /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: dUrl })] }), PushType.Dynamic);
945
936
  if (this.config.pushImgsInDynamic) {
946
937
  if (item.type === "DYNAMIC_TYPE_DRAW") {
947
938
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
@@ -1024,15 +1015,15 @@ var ComRegister = class {
1024
1015
  }, 1).catch(async (e$1) => {
1025
1016
  if (e$1.message === "直播开播动态,不做处理") return;
1026
1017
  if (e$1.message === "出现关键词,屏蔽该动态") {
1027
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}发布了一条含有屏蔽关键字的动态`, PushType.Dynamic);
1018
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$3, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
1028
1019
  return;
1029
1020
  }
1030
1021
  if (e$1.message === "已屏蔽转发动态") {
1031
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}转发了一条动态,已屏蔽`, PushType.Dynamic);
1022
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$3, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
1032
1023
  return;
1033
1024
  }
1034
1025
  if (e$1.message === "已屏蔽专栏动态") {
1035
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}投稿了一条专栏,已屏蔽`, PushType.Dynamic);
1026
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$3, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1036
1027
  return;
1037
1028
  }
1038
1029
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e$1.message}`);
@@ -1051,7 +1042,7 @@ var ComRegister = class {
1051
1042
  this.logger.info("动态链接生成成功!");
1052
1043
  }
1053
1044
  this.logger.info("推送动态中...");
1054
- await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)(__satorijs_element_jsx_runtime.Fragment, { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1045
+ await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(buffer, "image/jpeg") }), /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: dUrl })] }), PushType.Dynamic);
1055
1046
  if (this.config.pushImgsInDynamic) {
1056
1047
  this.logger.info("需要发送动态中的图片,开始发送...");
1057
1048
  if (item.type === "DYNAMIC_TYPE_DRAW") {
@@ -1123,7 +1114,7 @@ var ComRegister = class {
1123
1114
  this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e$1.message}`);
1124
1115
  });
1125
1116
  if (!buffer) return await this.sendPrivateMsgAndStopService();
1126
- const msg = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)(__satorijs_element_jsx_runtime.Fragment, { children: [koishi.h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] });
1117
+ const msg = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(buffer, "image/jpeg") }), /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: liveNotifyMsg || "" })] });
1127
1118
  return await this.broadcastToTargets(uid, msg, liveType === LiveType.StartBroadcasting ? PushType.StartBroadcasting : PushType.Live);
1128
1119
  }
1129
1120
  async liveDetectWithListener(roomId, uid, cardStyle) {
@@ -1188,7 +1179,15 @@ var ComRegister = class {
1188
1179
  watchedNum = body.text_small;
1189
1180
  },
1190
1181
  onGuardBuy: ({ body }) => {
1191
- const content = `[${masterInfo.username}的直播间]「${body.user.uname}」加入了大航海(${body.gift_name})`;
1182
+ const content = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [
1183
+ "【",
1184
+ masterInfo.username,
1185
+ "的直播间】",
1186
+ body.user.uname,
1187
+ "加入了大航海(",
1188
+ body.gift_name,
1189
+ ")"
1190
+ ] });
1192
1191
  this.broadcastToTargets(uid, content, PushType.LiveGuardBuy);
1193
1192
  },
1194
1193
  onLiveStart: async () => {
@@ -58063,7 +58062,7 @@ var require_helpers$1 = __commonJS$1({ "node_modules/socks/build/common/helpers.
58063
58062
  }
58064
58063
  function ipv4ToInt32(ip) {
58065
58064
  const address = new ip_address_1$1.Address4(ip);
58066
- return address.toArray().reduce((acc, part) => (acc << 8) + part, 0);
58065
+ return address.toArray().reduce((acc, part) => (acc << 8) + part, 0) >>> 0;
58067
58066
  }
58068
58067
  exports.ipv4ToInt32 = ipv4ToInt32;
58069
58068
  function int32ToIpv4(int32) {
package/lib/index.mjs CHANGED
@@ -554,7 +554,7 @@ var ComRegister = class {
554
554
  subManager = [];
555
555
  dynamicTimelineManager = /* @__PURE__ */ new Map();
556
556
  liveStatusManager = /* @__PURE__ */ new Map();
557
- pushRecord = {};
557
+ pushArrMap = /* @__PURE__ */ new Map();
558
558
  loginDBData;
559
559
  privateBot;
560
560
  dynamicJob;
@@ -799,7 +799,6 @@ var ComRegister = class {
799
799
  });
800
800
  }
801
801
  initPushRecord(subs) {
802
- const pushRecord = {};
803
802
  for (const sub of subs) {
804
803
  const atAllArr = [];
805
804
  const dynamicArr = [];
@@ -811,16 +810,15 @@ var ComRegister = class {
811
810
  if (channel.live) liveArr.push(`${platform.platform}:${channel.channelId}`);
812
811
  if (channel.liveGuardBuy) liveGuardBuyArr.push(`${platform.platform}:${channel.channelId}`);
813
812
  }
814
- pushRecord[sub.uid] = {
813
+ this.pushArrMap.set(sub.uid, {
815
814
  atAllArr,
816
815
  dynamicArr,
817
816
  liveArr,
818
817
  liveGuardBuyArr
819
- };
818
+ });
820
819
  }
821
- this.pushRecord = pushRecord;
822
820
  this.logger.info("初始化推送群组/频道信息:");
823
- this.logger.info(this.pushRecord);
821
+ this.logger.info(this.pushArrMap);
824
822
  }
825
823
  checkAllBotsAreReady() {
826
824
  return !this.ctx.bots.some((bot) => bot.status !== Universal.Status.ONLINE);
@@ -834,15 +832,8 @@ var ComRegister = class {
834
832
  return;
835
833
  }
836
834
  this.logger.info(`本次推送对象:${uid},推送类型:${PushTypeMsg[type]}`);
837
- const record = this.pushRecord[uid];
835
+ const record = this.pushArrMap.get(uid);
838
836
  this.logger.info("本次推送目标:");
839
- {
840
- this.logger.info(record.atAllArr);
841
- const success = await withRetry(async () => {
842
- return await this.ctx.broadcast(record.atAllArr, /* @__PURE__ */ jsx("message", { children: /* @__PURE__ */ jsx("at", { type: "all" }) }));
843
- }, 1);
844
- this.logger.info(`成功推送全体成员消息群组/频道:${success}`);
845
- }
846
837
  if (type === PushType.StartBroadcasting && record.atAllArr?.length >= 1) {
847
838
  this.logger.info(record.atAllArr);
848
839
  const success = await withRetry(async () => {
@@ -921,15 +912,15 @@ var ComRegister = class {
921
912
  }, 1).catch(async (e$1) => {
922
913
  if (e$1.message === "直播开播动态,不做处理") return;
923
914
  if (e$1.message === "出现关键词,屏蔽该动态") {
924
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}发布了一条含有屏蔽关键字的动态`, PushType.Dynamic);
915
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [name$3, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
925
916
  return;
926
917
  }
927
918
  if (e$1.message === "已屏蔽转发动态") {
928
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}转发了一条动态,已屏蔽`, PushType.Dynamic);
919
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [name$3, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
929
920
  return;
930
921
  }
931
922
  if (e$1.message === "已屏蔽专栏动态") {
932
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}投稿了一条专栏,已屏蔽`, PushType.Dynamic);
923
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [name$3, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
933
924
  return;
934
925
  }
935
926
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e$1.message}`);
@@ -943,7 +934,7 @@ var ComRegister = class {
943
934
  } else dUrl = `${name$3}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
944
935
  else dUrl = `${name$3}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
945
936
  this.logger.info("推送动态中...");
946
- await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs(Fragment, { children: [h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
937
+ await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [/* @__PURE__ */ jsx("message", { children: h.image(buffer, "image/jpeg") }), /* @__PURE__ */ jsx("message", { children: dUrl })] }), PushType.Dynamic);
947
938
  if (this.config.pushImgsInDynamic) {
948
939
  if (item.type === "DYNAMIC_TYPE_DRAW") {
949
940
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
@@ -1026,15 +1017,15 @@ var ComRegister = class {
1026
1017
  }, 1).catch(async (e$1) => {
1027
1018
  if (e$1.message === "直播开播动态,不做处理") return;
1028
1019
  if (e$1.message === "出现关键词,屏蔽该动态") {
1029
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}发布了一条含有屏蔽关键字的动态`, PushType.Dynamic);
1020
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [name$3, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
1030
1021
  return;
1031
1022
  }
1032
1023
  if (e$1.message === "已屏蔽转发动态") {
1033
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}转发了一条动态,已屏蔽`, PushType.Dynamic);
1024
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [name$3, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
1034
1025
  return;
1035
1026
  }
1036
1027
  if (e$1.message === "已屏蔽专栏动态") {
1037
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}投稿了一条专栏,已屏蔽`, PushType.Dynamic);
1028
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [name$3, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1038
1029
  return;
1039
1030
  }
1040
1031
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e$1.message}`);
@@ -1053,7 +1044,7 @@ var ComRegister = class {
1053
1044
  this.logger.info("动态链接生成成功!");
1054
1045
  }
1055
1046
  this.logger.info("推送动态中...");
1056
- await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs(Fragment, { children: [h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1047
+ await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [/* @__PURE__ */ jsx("message", { children: h.image(buffer, "image/jpeg") }), /* @__PURE__ */ jsx("message", { children: dUrl })] }), PushType.Dynamic);
1057
1048
  if (this.config.pushImgsInDynamic) {
1058
1049
  this.logger.info("需要发送动态中的图片,开始发送...");
1059
1050
  if (item.type === "DYNAMIC_TYPE_DRAW") {
@@ -1125,7 +1116,7 @@ var ComRegister = class {
1125
1116
  this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e$1.message}`);
1126
1117
  });
1127
1118
  if (!buffer) return await this.sendPrivateMsgAndStopService();
1128
- const msg = /* @__PURE__ */ jsxs(Fragment, { children: [h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] });
1119
+ const msg = /* @__PURE__ */ jsxs("message", { children: [/* @__PURE__ */ jsx("message", { children: h.image(buffer, "image/jpeg") }), /* @__PURE__ */ jsx("message", { children: liveNotifyMsg || "" })] });
1129
1120
  return await this.broadcastToTargets(uid, msg, liveType === LiveType.StartBroadcasting ? PushType.StartBroadcasting : PushType.Live);
1130
1121
  }
1131
1122
  async liveDetectWithListener(roomId, uid, cardStyle) {
@@ -1190,7 +1181,15 @@ var ComRegister = class {
1190
1181
  watchedNum = body.text_small;
1191
1182
  },
1192
1183
  onGuardBuy: ({ body }) => {
1193
- const content = `[${masterInfo.username}的直播间]「${body.user.uname}」加入了大航海(${body.gift_name})`;
1184
+ const content = /* @__PURE__ */ jsxs("message", { children: [
1185
+ "【",
1186
+ masterInfo.username,
1187
+ "的直播间】",
1188
+ body.user.uname,
1189
+ "加入了大航海(",
1190
+ body.gift_name,
1191
+ ")"
1192
+ ] });
1194
1193
  this.broadcastToTargets(uid, content, PushType.LiveGuardBuy);
1195
1194
  },
1196
1195
  onLiveStart: async () => {
@@ -58065,7 +58064,7 @@ var require_helpers$1 = __commonJS$1({ "node_modules/socks/build/common/helpers.
58065
58064
  }
58066
58065
  function ipv4ToInt32(ip) {
58067
58066
  const address = new ip_address_1$1.Address4(ip);
58068
- return address.toArray().reduce((acc, part) => (acc << 8) + part, 0);
58067
+ return address.toArray().reduce((acc, part) => (acc << 8) + part, 0) >>> 0;
58069
58068
  }
58070
58069
  exports.ipv4ToInt32 = ipv4ToInt32;
58071
58070
  function int32ToIpv4(int32) {
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.2.5-alpha.10",
4
+ "version": "3.2.5-alpha.12",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -289,6 +289,8 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
289
289
  > - ver 3.2.5-alpha.8 测试版本
290
290
  > - ver 3.2.5-alpha.9 测试版本
291
291
  > - ver 3.2.5-alpha.10 测试版本
292
+ > - ver 3.2.5-alpha.11 测试版本
293
+ > - ver 3.2.5-alpha.12 测试版本
292
294
 
293
295
  ## 交流群
294
296