koishi-plugin-bilibili-notify 3.2.5-alpha.8 → 3.2.5

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.d.mts CHANGED
@@ -45,6 +45,7 @@ interface Config {
45
45
  }>;
46
46
  dynamic: {};
47
47
  dynamicUrl: boolean;
48
+ dynamicCron: string;
48
49
  dynamicVideoUrlToBV: boolean;
49
50
  pushImgsInDynamic: boolean;
50
51
  live: {};
package/lib/index.d.ts CHANGED
@@ -45,6 +45,7 @@ interface Config {
45
45
  }>;
46
46
  dynamic: {};
47
47
  dynamicUrl: boolean;
48
+ dynamicCron: string;
48
49
  dynamicVideoUrlToBV: boolean;
49
50
  pushImgsInDynamic: boolean;
50
51
  live: {};
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,20 +808,18 @@ 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
- const bot = this.ctx.bots.some((bot$1) => !bot$1.isActive);
825
- return !bot;
822
+ return !this.ctx.bots.some((bot) => bot.status !== koishi.Universal.Status.ONLINE);
826
823
  }
827
824
  async broadcastToTargets(uid, content, type, retry = 3e3) {
828
825
  if (!this.checkAllBotsAreReady()) {
@@ -833,33 +830,37 @@ var ComRegister = class {
833
830
  return;
834
831
  }
835
832
  this.logger.info(`本次推送对象:${uid},推送类型:${PushTypeMsg[type]}`);
836
- const record = this.pushRecord[uid];
833
+ const record = this.pushArrMap.get(uid);
837
834
  this.logger.info("本次推送目标:");
838
835
  if (type === PushType.StartBroadcasting && record.atAllArr?.length >= 1) {
839
836
  this.logger.info(record.atAllArr);
837
+ const atAllArr = structuredClone(record.atAllArr);
840
838
  const success = await withRetry(async () => {
841
- return await this.ctx.broadcast(record.atAllArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("at", { type: "all" }), /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content })] }));
839
+ return await this.ctx.broadcast(atAllArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("at", { type: "all" }) }));
842
840
  }, 1);
843
841
  this.logger.info(`成功推送全体成员消息群组/频道:${success}`);
844
842
  }
845
843
  if (type === PushType.Dynamic && record.dynamicArr?.length >= 1) {
846
844
  this.logger.info(record.dynamicArr);
845
+ const dynamicArr = structuredClone(record.dynamicArr);
847
846
  const success = await withRetry(async () => {
848
- return await this.ctx.broadcast(record.dynamicArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
847
+ return await this.ctx.broadcast(dynamicArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
849
848
  }, 1);
850
849
  this.logger.info(`成功推送动态消息群组/频道:${success}`);
851
850
  }
852
851
  if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length >= 1) {
853
852
  this.logger.info(record.liveArr);
853
+ const liveArr = structuredClone(record.liveArr);
854
854
  const success = await withRetry(async () => {
855
- return await this.ctx.broadcast(record.liveArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
855
+ return await this.ctx.broadcast(liveArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
856
856
  }, 1);
857
857
  this.logger.info(`成功推送直播消息群组/频道:${success}`);
858
858
  }
859
859
  if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length >= 1) {
860
860
  this.logger.info(record.liveGuardBuyArr);
861
+ const liveGuardBuyArr = structuredClone(record.liveGuardBuyArr);
861
862
  const success = await withRetry(async () => {
862
- return await this.ctx.broadcast(record.liveGuardBuyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
863
+ return await this.ctx.broadcast(liveGuardBuyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
863
864
  }, 1);
864
865
  this.logger.info(`成功推送上舰消息群组/频道:${success}`);
865
866
  }
@@ -913,15 +914,15 @@ var ComRegister = class {
913
914
  }, 1).catch(async (e$1) => {
914
915
  if (e$1.message === "直播开播动态,不做处理") return;
915
916
  if (e$1.message === "出现关键词,屏蔽该动态") {
916
- 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);
917
918
  return;
918
919
  }
919
920
  if (e$1.message === "已屏蔽转发动态") {
920
- 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);
921
922
  return;
922
923
  }
923
924
  if (e$1.message === "已屏蔽专栏动态") {
924
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}投稿了一条专栏,已屏蔽`, PushType.Dynamic);
925
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$3, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
925
926
  return;
926
927
  }
927
928
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e$1.message}`);
@@ -935,7 +936,7 @@ var ComRegister = class {
935
936
  } else dUrl = `${name$3}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
936
937
  else dUrl = `${name$3}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
937
938
  this.logger.info("推送动态中...");
938
- 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);
939
+ await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
939
940
  if (this.config.pushImgsInDynamic) {
940
941
  if (item.type === "DYNAMIC_TYPE_DRAW") {
941
942
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
@@ -1018,15 +1019,15 @@ var ComRegister = class {
1018
1019
  }, 1).catch(async (e$1) => {
1019
1020
  if (e$1.message === "直播开播动态,不做处理") return;
1020
1021
  if (e$1.message === "出现关键词,屏蔽该动态") {
1021
- 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);
1022
1023
  return;
1023
1024
  }
1024
1025
  if (e$1.message === "已屏蔽转发动态") {
1025
- 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);
1026
1027
  return;
1027
1028
  }
1028
1029
  if (e$1.message === "已屏蔽专栏动态") {
1029
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}投稿了一条专栏,已屏蔽`, PushType.Dynamic);
1030
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$3, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1030
1031
  return;
1031
1032
  }
1032
1033
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e$1.message}`);
@@ -1045,7 +1046,7 @@ var ComRegister = class {
1045
1046
  this.logger.info("动态链接生成成功!");
1046
1047
  }
1047
1048
  this.logger.info("推送动态中...");
1048
- 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);
1049
+ await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1049
1050
  if (this.config.pushImgsInDynamic) {
1050
1051
  this.logger.info("需要发送动态中的图片,开始发送...");
1051
1052
  if (item.type === "DYNAMIC_TYPE_DRAW") {
@@ -1117,7 +1118,7 @@ var ComRegister = class {
1117
1118
  this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e$1.message}`);
1118
1119
  });
1119
1120
  if (!buffer) return await this.sendPrivateMsgAndStopService();
1120
- const msg = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)(__satorijs_element_jsx_runtime.Fragment, { children: [koishi.h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] });
1121
+ const msg = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] });
1121
1122
  return await this.broadcastToTargets(uid, msg, liveType === LiveType.StartBroadcasting ? PushType.StartBroadcasting : PushType.Live);
1122
1123
  }
1123
1124
  async liveDetectWithListener(roomId, uid, cardStyle) {
@@ -1182,7 +1183,15 @@ var ComRegister = class {
1182
1183
  watchedNum = body.text_small;
1183
1184
  },
1184
1185
  onGuardBuy: ({ body }) => {
1185
- const content = `[${masterInfo.username}的直播间]「${body.user.uname}」加入了大航海(${body.gift_name})`;
1186
+ const content = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [
1187
+ "【",
1188
+ masterInfo.username,
1189
+ "的直播间】",
1190
+ body.user.uname,
1191
+ "加入了大航海(",
1192
+ body.gift_name,
1193
+ ")"
1194
+ ] });
1186
1195
  this.broadcastToTargets(uid, content, PushType.LiveGuardBuy);
1187
1196
  },
1188
1197
  onLiveStart: async () => {
@@ -1585,7 +1594,7 @@ var ComRegister = class {
1585
1594
  }
1586
1595
  }
1587
1596
  enableDynamicDetect() {
1588
- this.dynamicJob = new cron.CronJob("*/2 * * * *", this.config.dynamicDebugMode ? this.debug_dynamicDetect() : this.dynamicDetect());
1597
+ this.dynamicJob = new cron.CronJob(this.config.dynamicCron, this.config.dynamicDebugMode ? this.debug_dynamicDetect() : this.dynamicDetect());
1589
1598
  this.logger.info("动态监测已开启");
1590
1599
  this.dynamicJob.start();
1591
1600
  }
@@ -1641,6 +1650,7 @@ var ComRegister = class {
1641
1650
  customLive: koishi.Schema.string(),
1642
1651
  customLiveEnd: koishi.Schema.string().required(),
1643
1652
  dynamicUrl: koishi.Schema.boolean().required(),
1653
+ dynamicCron: koishi.Schema.string().required(),
1644
1654
  dynamicVideoUrlToBV: koishi.Schema.boolean().required(),
1645
1655
  filter: koishi.Schema.object({
1646
1656
  enable: koishi.Schema.boolean(),
@@ -58057,7 +58067,7 @@ var require_helpers$1 = __commonJS$1({ "node_modules/socks/build/common/helpers.
58057
58067
  }
58058
58068
  function ipv4ToInt32(ip) {
58059
58069
  const address = new ip_address_1$1.Address4(ip);
58060
- return address.toArray().reduce((acc, part) => (acc << 8) + part, 0);
58070
+ return address.toArray().reduce((acc, part) => (acc << 8) + part, 0) >>> 0;
58061
58071
  }
58062
58072
  exports.ipv4ToInt32 = ipv4ToInt32;
58063
58073
  function int32ToIpv4(int32) {
@@ -95032,6 +95042,7 @@ var ServerManager = class extends koishi.Service {
95032
95042
  customLive: globalConfig.customLive,
95033
95043
  customLiveEnd: globalConfig.customLiveEnd,
95034
95044
  dynamicUrl: globalConfig.dynamicUrl,
95045
+ dynamicCron: globalConfig.dynamicCron,
95035
95046
  dynamicVideoUrlToBV: globalConfig.dynamicVideoUrlToBV,
95036
95047
  filter: globalConfig.filter,
95037
95048
  dynamicDebugMode: globalConfig.dynamicDebugMode
@@ -95129,6 +95140,7 @@ const Config = koishi.Schema.object({
95129
95140
  }).collapse()).collapse().description("输入订阅信息,自定义订阅内容; uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播"),
95130
95141
  dynamic: koishi.Schema.object({}).description("动态推送设置"),
95131
95142
  dynamicUrl: koishi.Schema.boolean().default(false).description("发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!"),
95143
+ dynamicCron: koishi.Schema.string().default("*/2 * * * *").description("动态监测时间,请填入cron表达式,请勿填入过短时间"),
95132
95144
  dynamicVideoUrlToBV: koishi.Schema.boolean().default(false).description("如果推送的动态是视频动态,且开启了发送链接选项,开启此选项则会将链接转换为BV号以便其他用途"),
95133
95145
  pushImgsInDynamic: koishi.Schema.boolean().default(false).description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
95134
95146
  live: koishi.Schema.object({}).description("直播推送设置"),
package/lib/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
- import { Schema, Service, h, isNullable, remove } from "koishi";
2
+ import { Schema, Service, Universal, h, isNullable, remove } from "koishi";
3
3
  import { resolve } from "path";
4
4
  import QRCode from "qrcode";
5
5
  import { CronJob } from "cron";
@@ -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,20 +810,18 @@ 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
- const bot = this.ctx.bots.some((bot$1) => !bot$1.isActive);
827
- return !bot;
824
+ return !this.ctx.bots.some((bot) => bot.status !== Universal.Status.ONLINE);
828
825
  }
829
826
  async broadcastToTargets(uid, content, type, retry = 3e3) {
830
827
  if (!this.checkAllBotsAreReady()) {
@@ -835,33 +832,37 @@ var ComRegister = class {
835
832
  return;
836
833
  }
837
834
  this.logger.info(`本次推送对象:${uid},推送类型:${PushTypeMsg[type]}`);
838
- const record = this.pushRecord[uid];
835
+ const record = this.pushArrMap.get(uid);
839
836
  this.logger.info("本次推送目标:");
840
837
  if (type === PushType.StartBroadcasting && record.atAllArr?.length >= 1) {
841
838
  this.logger.info(record.atAllArr);
839
+ const atAllArr = structuredClone(record.atAllArr);
842
840
  const success = await withRetry(async () => {
843
- return await this.ctx.broadcast(record.atAllArr, /* @__PURE__ */ jsxs("message", { children: [/* @__PURE__ */ jsx("at", { type: "all" }), /* @__PURE__ */ jsx("message", { children: content })] }));
841
+ return await this.ctx.broadcast(atAllArr, /* @__PURE__ */ jsx("message", { children: /* @__PURE__ */ jsx("at", { type: "all" }) }));
844
842
  }, 1);
845
843
  this.logger.info(`成功推送全体成员消息群组/频道:${success}`);
846
844
  }
847
845
  if (type === PushType.Dynamic && record.dynamicArr?.length >= 1) {
848
846
  this.logger.info(record.dynamicArr);
847
+ const dynamicArr = structuredClone(record.dynamicArr);
849
848
  const success = await withRetry(async () => {
850
- return await this.ctx.broadcast(record.dynamicArr, /* @__PURE__ */ jsx("message", { children: content }));
849
+ return await this.ctx.broadcast(dynamicArr, /* @__PURE__ */ jsx("message", { children: content }));
851
850
  }, 1);
852
851
  this.logger.info(`成功推送动态消息群组/频道:${success}`);
853
852
  }
854
853
  if ((type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length >= 1) {
855
854
  this.logger.info(record.liveArr);
855
+ const liveArr = structuredClone(record.liveArr);
856
856
  const success = await withRetry(async () => {
857
- return await this.ctx.broadcast(record.liveArr, /* @__PURE__ */ jsx("message", { children: content }));
857
+ return await this.ctx.broadcast(liveArr, /* @__PURE__ */ jsx("message", { children: content }));
858
858
  }, 1);
859
859
  this.logger.info(`成功推送直播消息群组/频道:${success}`);
860
860
  }
861
861
  if (type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length >= 1) {
862
862
  this.logger.info(record.liveGuardBuyArr);
863
+ const liveGuardBuyArr = structuredClone(record.liveGuardBuyArr);
863
864
  const success = await withRetry(async () => {
864
- return await this.ctx.broadcast(record.liveGuardBuyArr, /* @__PURE__ */ jsx("message", { children: content }));
865
+ return await this.ctx.broadcast(liveGuardBuyArr, /* @__PURE__ */ jsx("message", { children: content }));
865
866
  }, 1);
866
867
  this.logger.info(`成功推送上舰消息群组/频道:${success}`);
867
868
  }
@@ -915,15 +916,15 @@ var ComRegister = class {
915
916
  }, 1).catch(async (e$1) => {
916
917
  if (e$1.message === "直播开播动态,不做处理") return;
917
918
  if (e$1.message === "出现关键词,屏蔽该动态") {
918
- 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);
919
920
  return;
920
921
  }
921
922
  if (e$1.message === "已屏蔽转发动态") {
922
- 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);
923
924
  return;
924
925
  }
925
926
  if (e$1.message === "已屏蔽专栏动态") {
926
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}投稿了一条专栏,已屏蔽`, PushType.Dynamic);
927
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [name$3, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
927
928
  return;
928
929
  }
929
930
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e$1.message}`);
@@ -937,7 +938,7 @@ var ComRegister = class {
937
938
  } else dUrl = `${name$3}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
938
939
  else dUrl = `${name$3}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
939
940
  this.logger.info("推送动态中...");
940
- await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs(Fragment, { children: [h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
941
+ await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
941
942
  if (this.config.pushImgsInDynamic) {
942
943
  if (item.type === "DYNAMIC_TYPE_DRAW") {
943
944
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
@@ -1020,15 +1021,15 @@ var ComRegister = class {
1020
1021
  }, 1).catch(async (e$1) => {
1021
1022
  if (e$1.message === "直播开播动态,不做处理") return;
1022
1023
  if (e$1.message === "出现关键词,屏蔽该动态") {
1023
- 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);
1024
1025
  return;
1025
1026
  }
1026
1027
  if (e$1.message === "已屏蔽转发动态") {
1027
- 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);
1028
1029
  return;
1029
1030
  }
1030
1031
  if (e$1.message === "已屏蔽专栏动态") {
1031
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, `${name$3}投稿了一条专栏,已屏蔽`, PushType.Dynamic);
1032
+ if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [name$3, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1032
1033
  return;
1033
1034
  }
1034
1035
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e$1.message}`);
@@ -1047,7 +1048,7 @@ var ComRegister = class {
1047
1048
  this.logger.info("动态链接生成成功!");
1048
1049
  }
1049
1050
  this.logger.info("推送动态中...");
1050
- await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs(Fragment, { children: [h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1051
+ await this.broadcastToTargets(sub.uid, /* @__PURE__ */ jsxs("message", { children: [h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1051
1052
  if (this.config.pushImgsInDynamic) {
1052
1053
  this.logger.info("需要发送动态中的图片,开始发送...");
1053
1054
  if (item.type === "DYNAMIC_TYPE_DRAW") {
@@ -1119,7 +1120,7 @@ var ComRegister = class {
1119
1120
  this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e$1.message}`);
1120
1121
  });
1121
1122
  if (!buffer) return await this.sendPrivateMsgAndStopService();
1122
- const msg = /* @__PURE__ */ jsxs(Fragment, { children: [h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] });
1123
+ const msg = /* @__PURE__ */ jsxs("message", { children: [h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] });
1123
1124
  return await this.broadcastToTargets(uid, msg, liveType === LiveType.StartBroadcasting ? PushType.StartBroadcasting : PushType.Live);
1124
1125
  }
1125
1126
  async liveDetectWithListener(roomId, uid, cardStyle) {
@@ -1184,7 +1185,15 @@ var ComRegister = class {
1184
1185
  watchedNum = body.text_small;
1185
1186
  },
1186
1187
  onGuardBuy: ({ body }) => {
1187
- const content = `[${masterInfo.username}的直播间]「${body.user.uname}」加入了大航海(${body.gift_name})`;
1188
+ const content = /* @__PURE__ */ jsxs("message", { children: [
1189
+ "【",
1190
+ masterInfo.username,
1191
+ "的直播间】",
1192
+ body.user.uname,
1193
+ "加入了大航海(",
1194
+ body.gift_name,
1195
+ ")"
1196
+ ] });
1188
1197
  this.broadcastToTargets(uid, content, PushType.LiveGuardBuy);
1189
1198
  },
1190
1199
  onLiveStart: async () => {
@@ -1587,7 +1596,7 @@ var ComRegister = class {
1587
1596
  }
1588
1597
  }
1589
1598
  enableDynamicDetect() {
1590
- this.dynamicJob = new CronJob("*/2 * * * *", this.config.dynamicDebugMode ? this.debug_dynamicDetect() : this.dynamicDetect());
1599
+ this.dynamicJob = new CronJob(this.config.dynamicCron, this.config.dynamicDebugMode ? this.debug_dynamicDetect() : this.dynamicDetect());
1591
1600
  this.logger.info("动态监测已开启");
1592
1601
  this.dynamicJob.start();
1593
1602
  }
@@ -1643,6 +1652,7 @@ var ComRegister = class {
1643
1652
  customLive: Schema.string(),
1644
1653
  customLiveEnd: Schema.string().required(),
1645
1654
  dynamicUrl: Schema.boolean().required(),
1655
+ dynamicCron: Schema.string().required(),
1646
1656
  dynamicVideoUrlToBV: Schema.boolean().required(),
1647
1657
  filter: Schema.object({
1648
1658
  enable: Schema.boolean(),
@@ -58059,7 +58069,7 @@ var require_helpers$1 = __commonJS$1({ "node_modules/socks/build/common/helpers.
58059
58069
  }
58060
58070
  function ipv4ToInt32(ip) {
58061
58071
  const address = new ip_address_1$1.Address4(ip);
58062
- return address.toArray().reduce((acc, part) => (acc << 8) + part, 0);
58072
+ return address.toArray().reduce((acc, part) => (acc << 8) + part, 0) >>> 0;
58063
58073
  }
58064
58074
  exports.ipv4ToInt32 = ipv4ToInt32;
58065
58075
  function int32ToIpv4(int32) {
@@ -95034,6 +95044,7 @@ var ServerManager = class extends Service {
95034
95044
  customLive: globalConfig.customLive,
95035
95045
  customLiveEnd: globalConfig.customLiveEnd,
95036
95046
  dynamicUrl: globalConfig.dynamicUrl,
95047
+ dynamicCron: globalConfig.dynamicCron,
95037
95048
  dynamicVideoUrlToBV: globalConfig.dynamicVideoUrlToBV,
95038
95049
  filter: globalConfig.filter,
95039
95050
  dynamicDebugMode: globalConfig.dynamicDebugMode
@@ -95131,6 +95142,7 @@ const Config = Schema.object({
95131
95142
  }).collapse()).collapse().description("输入订阅信息,自定义订阅内容; uid: 订阅用户UID,dynamic: 是否需要订阅动态,live: 是否需要订阅直播"),
95132
95143
  dynamic: Schema.object({}).description("动态推送设置"),
95133
95144
  dynamicUrl: Schema.boolean().default(false).description("发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!"),
95145
+ dynamicCron: Schema.string().default("*/2 * * * *").description("动态监测时间,请填入cron表达式,请勿填入过短时间"),
95134
95146
  dynamicVideoUrlToBV: Schema.boolean().default(false).description("如果推送的动态是视频动态,且开启了发送链接选项,开启此选项则会将链接转换为BV号以便其他用途"),
95135
95147
  pushImgsInDynamic: Schema.boolean().default(false).description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
95136
95148
  live: Schema.object({}).description("直播推送设置"),
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.8",
4
+ "version": "3.2.5",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
@@ -48,7 +48,7 @@
48
48
  "tough-cookie": "^5.1.2"
49
49
  },
50
50
  "devDependencies": {
51
- "@biomejs/biome": "1.9.4",
51
+ "@biomejs/biome": "^1.9.4",
52
52
  "@koishijs/cache": "^2.1.0",
53
53
  "@koishijs/client": "^5.30.8",
54
54
  "@koishijs/plugin-help": "^2.4.5",
package/readme.md CHANGED
@@ -287,6 +287,13 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
287
287
  > - ver 3.2.5-alpha.6 测试版本
288
288
  > - ver 3.2.5-alpha.7 测试版本
289
289
  > - ver 3.2.5-alpha.8 测试版本
290
+ > - ver 3.2.5-alpha.9 测试版本
291
+ > - ver 3.2.5-alpha.10 测试版本
292
+ > - ver 3.2.5-alpha.11 测试版本
293
+ > - ver 3.2.5-alpha.12 测试版本
294
+ > - ver 3.2.5-alpha.13 测试版本
295
+
296
+ - ver 3.2.5 重构:消息推送逻辑; 新增:选项 `dynamicCron`;
290
297
 
291
298
  ## 交流群
292
299