koishi-plugin-bilibili-notify 3.3.1-alpha.1 → 3.3.1-rc.1

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
@@ -64,7 +64,7 @@ const BAConfigSchema = koishi.Schema.object({
64
64
  "satori",
65
65
  "chronocat",
66
66
  "lark"
67
- ]).description("请选择您的私人机器人平台,目前支持QQ、QQ群、OneBot、Discord、RedBot、Telegram、Satori、ChronoCat、Lark。从2.0版本开始,只能在一个平台下使用本插件"),
67
+ ]).description("请选择您的私人机器人平台"),
68
68
  masterAccount: koishi.Schema.string().role("secret").required().description("主人账号,在Q群使用可直接使用QQ号,若在其他平台使用,请使用inspect插件获取自身ID"),
69
69
  masterAccountGuildId: koishi.Schema.string().role("secret").description("主人账号所在的群组ID,只有在QQ频道、Discord这样的环境才需要填写,请使用inspect插件获取群组ID")
70
70
  }), koishi.Schema.object({})])]),
@@ -364,17 +364,19 @@ var ComRegister = class {
364
364
  rebootCount = 0;
365
365
  subNotifier;
366
366
  ctx;
367
- subManager = [];
368
- dynamicTimelineManager = new Map();
369
- liveStatusManager = new Map();
370
- liveMsgManager = new Map();
371
- pushArrMap = new Map();
367
+ subManager;
368
+ dynamicTimelineManager;
369
+ liveAPIManager;
370
+ liveWSManager;
371
+ liveMsgManager;
372
+ pushArrMap;
372
373
  loginDBData;
373
374
  privateBot;
374
375
  dynamicJob;
375
- liveJob;
376
+ liveAPIJob;
376
377
  _jieba = __node_rs_jieba.Jieba.withDict(__node_rs_jieba_dict.dict);
377
378
  stopwords;
379
+ reciveSubTimes = 0;
378
380
  constructor(ctx, config) {
379
381
  this.ctx = ctx;
380
382
  this.init(config);
@@ -409,7 +411,7 @@ var ComRegister = class {
409
411
  } catch (_) {
410
412
  return "bili login getLoginQRCode() 本次网络请求失败";
411
413
  }
412
- if (content.code !== 0) return await session.send("出问题咯,请联系管理员解决");
414
+ if (content.code !== 0) return await session.send("出问题咯!");
413
415
  qrcode.default.toBuffer(content.data.url, {
414
416
  errorCorrectionLevel: "H",
415
417
  type: "png",
@@ -474,16 +476,16 @@ var ComRegister = class {
474
476
  biliCom.subcommand(".ll").usage("展示当前正在直播的订阅对象").example("bili ll").action(async () => {
475
477
  const { data: { live_users } } = await ctx["bilibili-notify-api"].getTheUserWhoIsLiveStreaming();
476
478
  const subLiveUsers = [];
477
- for (const sub of this.subManager) {
479
+ for (const [uid, sub] of this.subManager) {
478
480
  let onLive = false;
479
481
  if (live_users.items) {
480
- for (const user of live_users.items) if (user.mid.toString() === sub.uid && sub.live) {
482
+ for (const user of live_users.items) if (user.mid.toString() === uid && sub.live) {
481
483
  onLive = true;
482
484
  break;
483
485
  }
484
486
  }
485
487
  subLiveUsers.push({
486
- uid: Number.parseInt(sub.uid),
488
+ uid: Number.parseInt(uid),
487
489
  uname: sub.uname,
488
490
  onLive
489
491
  });
@@ -612,7 +614,7 @@ var ComRegister = class {
612
614
  ["初中", 4],
613
615
  ["毕业", 4]
614
616
  ];
615
- await session.send(/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(words, "词云测试"), "image/jpg") }));
617
+ const img = koishi.h.image(await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(words, "词云测试"), "image/jpg");
616
618
  const top5DanmakuMaker = [
617
619
  ["张三", 60],
618
620
  ["李四", 48],
@@ -620,8 +622,8 @@ var ComRegister = class {
620
622
  ["赵六", 27],
621
623
  ["田七", 25]
622
624
  ];
623
- const danmakerRankMsg = 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");
624
- await session.send(danmakerRankMsg);
625
+ 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
627
  });
626
628
  biliCom.subcommand(".cap").action(async ({ session }) => {
627
629
  const { code: userInfoCode, data: userInfoData } = await withRetry(async () => {
@@ -643,7 +645,9 @@ var ComRegister = class {
643
645
  const seccode = `${validate}|jordan`;
644
646
  const { data: validateCaptchaData } = await ctx["bilibili-notify-api"].validateCaptcha(data.geetest.challenge, data.token, validate, seccode);
645
647
  if (validateCaptchaData?.is_valid !== 1) return "验证不成功!";
646
- await ctx["bilibili-notify-api"].getUserInfo("114514", validateCaptchaData.grisk_id);
648
+ await this.ctx.sleep(10 * 1e3);
649
+ const { code: validCode, data: validData } = await ctx["bilibili-notify-api"].getUserInfo("114514", validateCaptchaData.grisk_id);
650
+ if (validCode === -352 && validData.v_voucher) return "验证不成功!";
647
651
  await session.send("验证成功!请重启插件");
648
652
  });
649
653
  }
@@ -660,25 +664,34 @@ var ComRegister = class {
660
664
  return;
661
665
  }
662
666
  this.mergeStopWords(config.wordcloudStopWords);
663
- if (config.advancedSub) {
664
- this.ctx.on("bilibili-notify/advanced-sub", async (subs) => {
665
- await this.initAsyncPart(subs);
666
- });
667
- this.ctx.emit("bilibili-notify/ready-to-recive");
668
- } else if (config.subs && config.subs.length > 0) {
667
+ this.registeringForEvents();
668
+ if (config.advancedSub) this.ctx.emit("bilibili-notify/ready-to-recive");
669
+ else if (config.subs && config.subs.length > 0) {
669
670
  const subs = this.configSubsToSubscription(config.subs);
670
671
  await this.initAsyncPart(subs);
671
672
  }
673
+ }
674
+ registeringForEvents() {
672
675
  this.ctx.on("dispose", () => {
673
676
  if (this.loginTimer) this.loginTimer();
674
677
  if (this.dynamicJob) this.dynamicJob.stop();
675
- if (this.liveJob) this.liveJob.stop();
678
+ if (this.liveAPIJob) this.liveAPIJob.stop();
679
+ for (const [roomId, timer] of this.liveWSManager) {
680
+ this.ctx["bilibili-notify-live"].closeListener(roomId);
681
+ if (timer) timer();
682
+ }
683
+ });
684
+ this.ctx.on("bilibili-notify/advanced-sub", async (subs) => {
685
+ if (this.reciveSubTimes >= 1) await this.ctx["bilibili-notify"].restartPlugin();
686
+ else await this.initAsyncPart(subs);
687
+ this.reciveSubTimes++;
676
688
  });
677
689
  }
678
690
  async initAsyncPart(subs) {
679
- const { code, msg } = await this.loadSubFromConfig(subs);
691
+ this.initAllManager();
692
+ const { code, message } = await this.loadSubFromConfig(subs);
680
693
  if (code !== 0) {
681
- this.logger.error(msg);
694
+ this.logger.error(message);
682
695
  this.logger.error("订阅对象加载失败,插件初始化失败!");
683
696
  await this.sendPrivateMsg("订阅对象加载失败,插件初始化失败!");
684
697
  return;
@@ -698,9 +711,9 @@ var ComRegister = class {
698
711
  this.stopwords = new Set([...stop_words_default, ...additionalStopWords]);
699
712
  }
700
713
  initManager() {
701
- for (const sub of this.subManager) {
702
- if (sub.dynamic) this.dynamicTimelineManager.set(sub.uid, Math.floor(luxon.DateTime.now().toSeconds()));
703
- if (sub.live) this.liveStatusManager.set(sub.uid, {
714
+ for (const [uid, sub] of this.subManager) {
715
+ if (sub.dynamic) this.dynamicTimelineManager.set(uid, Math.floor(luxon.DateTime.now().toSeconds()));
716
+ if (sub.live) this.liveAPIManager.set(uid, {
704
717
  roomId: sub.roomId,
705
718
  live: false,
706
719
  liveRoomInfo: void 0,
@@ -712,6 +725,14 @@ var ComRegister = class {
712
725
  });
713
726
  }
714
727
  }
728
+ initAllManager() {
729
+ this.subManager = new Map();
730
+ this.dynamicTimelineManager = new Map();
731
+ this.liveAPIManager = new Map();
732
+ this.liveWSManager = new Map();
733
+ this.liveMsgManager = new Map();
734
+ this.pushArrMap = new Map();
735
+ }
715
736
  configSubsToSubscription(sub) {
716
737
  const subs = {};
717
738
  sub.forEach((s) => {
@@ -927,25 +948,21 @@ var ComRegister = class {
927
948
  if (!content) return;
928
949
  if (content.code !== 0) switch (content.code) {
929
950
  case -101: {
930
- this.logger.error("账号未登录,插件已停止工作,请登录后,输入指令 bn start 启动插件");
931
- await this.sendPrivateMsg("账号未登录,插件已停止工作,请登录后,输入指令 bn start 启动插件");
951
+ this.logger.error("账号未登录,插件已停止工作,请登录");
952
+ await this.sendPrivateMsg("账号未登录,插件已停止工作,请登录");
932
953
  await this.ctx["bilibili-notify"].disposePlugin();
933
954
  break;
934
955
  }
935
956
  case -352: {
936
- this.logger.error("账号被风控,插件已停止工作,请确认风控解除后,输入指令 bn start 启动插件");
937
- await this.sendPrivateMsg("账号被风控,插件已停止工作,请确认风控解除后,输入指令 bn start 启动插件");
957
+ this.logger.error("账号被风控,插件已停止工作,请输入指令 bili cap 根据提示解除风控");
958
+ await this.sendPrivateMsg("账号被风控,插件已停止工作,请输入指令 bili cap 根据提示解除风控");
938
959
  await this.ctx["bilibili-notify"].disposePlugin();
939
960
  break;
940
961
  }
941
- case 4101128:
942
- case 4101129: {
943
- this.logger.error(`获取动态信息错误,错误码为:${content.code},错误为:${content.message}`);
944
- await this.sendPrivateMsg(`获取动态信息错误,错误码为:${content.code},错误为:${content.message}`);
945
- break;
946
- }
947
962
  default: {
948
- await this.sendPrivateMsg(`获取动态信息错误,错误码为:${content.code},错误为:${content.message}`);
963
+ this.logger.error(`获取动态信息错误,错误码为:${content.code},错误为:${content.message},请排除错误后输入指令 bn restart 重启插件`);
964
+ await this.sendPrivateMsg(`获取动态信息错误,错误码为:${content.code},错误为:${content.message},请排除错误后输入指令 bn restart 重启插件`);
965
+ await this.ctx["bilibili-notify"].disposePlugin();
949
966
  break;
950
967
  }
951
968
  }
@@ -958,21 +975,21 @@ var ComRegister = class {
958
975
  if (this.dynamicTimelineManager.has(uid)) {
959
976
  const timeline = this.dynamicTimelineManager.get(uid);
960
977
  if (timeline < postTime) {
961
- const sub = this.subManager.find((sub$1) => sub$1.uid === uid);
978
+ const sub = this.subManager.get(uid);
962
979
  const buffer = await withRetry(async () => {
963
980
  return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.customCardStyle.enable ? sub.customCardStyle : void 0);
964
981
  }, 1).catch(async (e) => {
965
982
  if (e.message === "直播开播动态,不做处理") return;
966
983
  if (e.message === "出现关键词,屏蔽该动态") {
967
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
984
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
968
985
  return;
969
986
  }
970
987
  if (e.message === "已屏蔽转发动态") {
971
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
988
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
972
989
  return;
973
990
  }
974
991
  if (e.message === "已屏蔽专栏动态") {
975
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
992
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
976
993
  return;
977
994
  }
978
995
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
@@ -986,7 +1003,7 @@ var ComRegister = class {
986
1003
  } else dUrl = `${name$2}发布了新视频:https:${item.modules.module_dynamic.major.archive.jump_url}`;
987
1004
  else dUrl = `${name$2}发布了一条动态:https://t.bilibili.com/${item.id_str}`;
988
1005
  this.logger.info("推送动态中...");
989
- await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1006
+ await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
990
1007
  if (this.config.pushImgsInDynamic) {
991
1008
  if (item.type === "DYNAMIC_TYPE_DRAW") {
992
1009
  const pics = item.modules?.module_dynamic?.major?.opus?.pics;
@@ -998,7 +1015,7 @@ var ComRegister = class {
998
1015
  alt: "动态图片"
999
1016
  }, pic.url))
1000
1017
  });
1001
- await this.broadcastToTargets(sub.uid, picsMsg, PushType.Dynamic);
1018
+ await this.broadcastToTargets(uid, picsMsg, PushType.Dynamic);
1002
1019
  }
1003
1020
  }
1004
1021
  }
@@ -1026,25 +1043,21 @@ var ComRegister = class {
1026
1043
  if (!content) return;
1027
1044
  if (content.code !== 0) switch (content.code) {
1028
1045
  case -101: {
1029
- this.logger.error("账号未登录,插件已停止工作,请登录后,输入指令 bn start 启动插件");
1030
- await this.sendPrivateMsg("账号未登录,插件已停止工作,请登录后,输入指令 bn start 启动插件");
1046
+ this.logger.error("账号未登录,插件已停止工作,请登录");
1047
+ await this.sendPrivateMsg("账号未登录,插件已停止工作,请登录");
1031
1048
  await this.ctx["bilibili-notify"].disposePlugin();
1032
1049
  break;
1033
1050
  }
1034
1051
  case -352: {
1035
- this.logger.error("账号被风控,插件已停止工作,请确认风控解除后,输入指令 bn start 启动插件");
1036
- await this.sendPrivateMsg("账号被风控,插件已停止工作,请确认风控解除后,输入指令 bn start 启动插件");
1052
+ this.logger.error("账号被风控,插件已停止工作,请输入指令 bili cap 根据提示解除风控");
1053
+ await this.sendPrivateMsg("账号被风控,插件已停止工作,请输入指令 bili cap 根据提示解除风控");
1037
1054
  await this.ctx["bilibili-notify"].disposePlugin();
1038
1055
  break;
1039
1056
  }
1040
- case 4101128:
1041
- case 4101129: {
1042
- this.logger.error(`获取动态信息错误,错误码为:${content.code},错误为:${content.message}`);
1043
- await this.sendPrivateMsg(`获取动态信息错误,错误码为:${content.code},错误为:${content.message}`);
1044
- break;
1045
- }
1046
1057
  default: {
1047
- await this.sendPrivateMsg(`获取动态信息错误,错误码为:${content.code},错误为:${content.message}`);
1058
+ this.logger.error(`获取动态信息错误,错误码为:${content.code},错误为:${content.message},请排除错误后输入指令 bn restart 重启插件`);
1059
+ await this.sendPrivateMsg(`获取动态信息错误,错误码为:${content.code},错误为:${content.message},请排除错误后输入指令 bn restart 重启插件`);
1060
+ await this.ctx["bilibili-notify"].disposePlugin();
1048
1061
  break;
1049
1062
  }
1050
1063
  }
@@ -1062,22 +1075,22 @@ var ComRegister = class {
1062
1075
  this.logger.info(`上次推送时间线:${luxon.DateTime.fromSeconds(timeline).toFormat("yyyy-MM-dd HH:mm:ss")}`);
1063
1076
  if (timeline < postTime) {
1064
1077
  this.logger.info("需要推送该条动态,开始推送...");
1065
- const sub = this.subManager.find((sub$1) => sub$1.uid === uid);
1078
+ const sub = this.subManager.get(uid);
1066
1079
  this.logger.info("开始渲染推送卡片...");
1067
1080
  const buffer = await withRetry(async () => {
1068
1081
  return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.customCardStyle.enable ? sub.customCardStyle : void 0);
1069
1082
  }, 1).catch(async (e) => {
1070
1083
  if (e.message === "直播开播动态,不做处理") return;
1071
1084
  if (e.message === "出现关键词,屏蔽该动态") {
1072
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
1085
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "发布了一条含有屏蔽关键字的动态"] }), PushType.Dynamic);
1073
1086
  return;
1074
1087
  }
1075
1088
  if (e.message === "已屏蔽转发动态") {
1076
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
1089
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "转发了一条动态,已屏蔽"] }), PushType.Dynamic);
1077
1090
  return;
1078
1091
  }
1079
1092
  if (e.message === "已屏蔽专栏动态") {
1080
- if (this.config.filter.notify) await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1093
+ if (this.config.filter.notify) await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [name$2, "投稿了一条专栏,已屏蔽"] }), PushType.Dynamic);
1081
1094
  return;
1082
1095
  }
1083
1096
  this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
@@ -1096,7 +1109,7 @@ var ComRegister = class {
1096
1109
  this.logger.info("动态链接生成成功!");
1097
1110
  }
1098
1111
  this.logger.info("推送动态中...");
1099
- await this.broadcastToTargets(sub.uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1112
+ await this.broadcastToTargets(uid, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [koishi.h.image(buffer, "image/jpeg"), dUrl] }), PushType.Dynamic);
1100
1113
  if (this.config.pushImgsInDynamic) {
1101
1114
  this.logger.info("需要发送动态中的图片,开始发送...");
1102
1115
  if (item.type === "DYNAMIC_TYPE_DRAW") {
@@ -1109,7 +1122,7 @@ var ComRegister = class {
1109
1122
  alt: "动态图片"
1110
1123
  }, pic.url))
1111
1124
  });
1112
- await this.broadcastToTargets(sub.uid, picsMsg, PushType.Dynamic);
1125
+ await this.broadcastToTargets(uid, picsMsg, PushType.Dynamic);
1113
1126
  }
1114
1127
  }
1115
1128
  this.logger.info("动态中的图片发送完毕!");
@@ -1198,13 +1211,12 @@ var ComRegister = class {
1198
1211
  this.logger.info(top90Words);
1199
1212
  this.logger.info("正在准备生成弹幕词云");
1200
1213
  const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
1201
- const img = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(buffer, "image/jpeg") });
1214
+ const img = koishi.h.image(buffer, "image/jpeg");
1202
1215
  this.logger.info("开始构建弹幕发送排行榜消息");
1203
1216
  const danmakuMakerCount = Object.keys(danmakuMakerRecord).length;
1204
1217
  const danmakuCount = Object.values(danmakuMakerRecord).reduce((sum, val) => sum + val, 0);
1205
1218
  const top5DanmakuMaker = Object.entries(danmakuMakerRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
1206
- const danmakuMakerMsg = customLiveSummary.replace("-dmc", `${danmakuMakerCount}`).replace("-mdn", `${masterInfo.medalName}`).replace("-dca", `${danmakuCount}`).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");
1207
- const summary = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: danmakuMakerMsg });
1219
+ const summary = customLiveSummary.replace("-dmc", `${danmakuMakerCount}`).replace("-mdn", `${masterInfo.medalName}`).replace("-dca", `${danmakuCount}`).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");
1208
1220
  await this.broadcastToTargets(sub.uid, [img, summary], PushType.WordCloudAndLiveSummary);
1209
1221
  Object.keys(danmakuWeightRecord).forEach((key) => delete danmakuWeightRecord[key]);
1210
1222
  Object.keys(danmakuMakerRecord).forEach((key) => delete danmakuMakerRecord[key]);
@@ -1292,7 +1304,10 @@ var ComRegister = class {
1292
1304
  masterInfo,
1293
1305
  cardStyle: sub.customCardStyle
1294
1306
  }, sub.uid, liveStartMsg);
1295
- if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
1307
+ if (this.config.pushTime !== 0 && !pushAtTimeTimer) {
1308
+ pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
1309
+ this.liveWSManager.set(roomId, pushAtTimeTimer);
1310
+ }
1296
1311
  },
1297
1312
  onLiveEnd: async () => {
1298
1313
  liveStatus = false;
@@ -1328,29 +1343,32 @@ var ComRegister = class {
1328
1343
  masterInfo,
1329
1344
  cardStyle: sub.customCardStyle
1330
1345
  }, sub.uid, liveMsg);
1331
- if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
1346
+ if (this.config.pushTime !== 0 && !pushAtTimeTimer) {
1347
+ pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
1348
+ this.liveWSManager.set(roomId, pushAtTimeTimer);
1349
+ }
1332
1350
  liveStatus = true;
1333
1351
  }
1334
1352
  }
1335
1353
  async liveDetectWithAPI() {
1336
- const useMasterAndLiveRoomInfo = async (liveType, liveStatus) => {
1354
+ const useMasterAndLiveRoomInfo = async (liveType, LiveAPIStatus) => {
1337
1355
  let flag = true;
1338
- liveStatus.liveRoomInfo = await this.useLiveRoomInfo(liveStatus.roomId).catch(() => {
1356
+ LiveAPIStatus.liveRoomInfo = await this.useLiveRoomInfo(LiveAPIStatus.roomId).catch(() => {
1339
1357
  flag = false;
1340
1358
  return null;
1341
1359
  });
1342
- if (!flag || !liveStatus.liveRoomInfo?.uid) {
1360
+ if (!flag || !LiveAPIStatus.liveRoomInfo?.uid) {
1343
1361
  flag = false;
1344
1362
  return flag;
1345
1363
  }
1346
- liveStatus.masterInfo = await this.useMasterInfo(liveStatus.liveRoomInfo.uid, liveStatus.masterInfo, liveType).catch(() => {
1364
+ LiveAPIStatus.masterInfo = await this.useMasterInfo(LiveAPIStatus.liveRoomInfo.uid, LiveAPIStatus.masterInfo, liveType).catch(() => {
1347
1365
  flag = false;
1348
1366
  return null;
1349
1367
  });
1350
1368
  return flag;
1351
1369
  };
1352
1370
  const uids = [];
1353
- for (const [uid] of this.liveStatusManager.entries()) uids.push(uid);
1371
+ for (const [uid] of this.liveAPIManager.entries()) uids.push(uid);
1354
1372
  const useLiveInfo = async () => {
1355
1373
  const { data: data$1 } = await withRetry(async () => await this.ctx["bilibili-notify-api"].getLiveRoomInfoByUids(uids), 3).catch(async () => {
1356
1374
  return void 0;
@@ -1364,96 +1382,96 @@ var ComRegister = class {
1364
1382
  const data = await useLiveInfo();
1365
1383
  for (const item of Object.values(data)) {
1366
1384
  const uid = item.uid.toString();
1367
- const liveStatus = this.liveStatusManager.get(uid);
1385
+ const LiveAPIStatus = this.liveAPIManager.get(uid);
1368
1386
  const liveMsgObj = this.liveMsgManager.get(uid);
1369
- const sub = this.subManager.find((sub$1) => sub$1.uid === uid);
1387
+ const sub = this.subManager.get(uid);
1370
1388
  if (item.live_status === 1) {
1371
- liveStatus.live = true;
1372
- await useMasterAndLiveRoomInfo(LiveType.FirstLiveBroadcast, liveStatus);
1373
- if (!liveStatus.liveStartTimeInit) {
1374
- liveStatus.liveStartTime = liveStatus.liveRoomInfo.live_time;
1375
- liveStatus.liveStartTimeInit = true;
1389
+ LiveAPIStatus.live = true;
1390
+ await useMasterAndLiveRoomInfo(LiveType.FirstLiveBroadcast, LiveAPIStatus);
1391
+ if (!LiveAPIStatus.liveStartTimeInit) {
1392
+ LiveAPIStatus.liveStartTime = LiveAPIStatus.liveRoomInfo.live_time;
1393
+ LiveAPIStatus.liveStartTimeInit = true;
1376
1394
  }
1377
- const liveMsg = liveMsgObj.customLive.replace("-name", liveStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveStatus.liveStartTime)).replace("-watched", "API模式无法获取").replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveStatus.liveRoomInfo.short_id === 0 ? liveStatus.liveRoomInfo.room_id : liveStatus.liveRoomInfo.short_id}`);
1395
+ const liveMsg = liveMsgObj.customLive.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-watched", "API模式无法获取").replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
1378
1396
  await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1379
- liveRoomInfo: liveStatus.liveRoomInfo,
1380
- masterInfo: liveStatus.masterInfo,
1397
+ liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1398
+ masterInfo: LiveAPIStatus.masterInfo,
1381
1399
  cardStyle: sub.customCardStyle
1382
- }, sub.uid, liveMsg);
1400
+ }, uid, liveMsg);
1383
1401
  }
1384
1402
  }
1385
1403
  const handler = async () => {
1386
1404
  const data$1 = await useLiveInfo();
1387
1405
  for (const item of Object.values(data$1)) {
1388
1406
  const uid = item.uid.toString();
1389
- const liveStatus = this.liveStatusManager.get(uid);
1407
+ const LiveAPIStatus = this.liveAPIManager.get(uid);
1390
1408
  const liveMsgObj = this.liveMsgManager.get(uid);
1391
- const sub = this.subManager.find((sub$1) => sub$1.uid === uid);
1409
+ const sub = this.subManager.get(uid);
1392
1410
  if (!sub) return;
1393
1411
  switch (item.live_status) {
1394
1412
  case 0:
1395
1413
  case 2: {
1396
- if (liveStatus.live === true) {
1397
- if (!await useMasterAndLiveRoomInfo(LiveType.StopBroadcast, liveStatus)) {
1414
+ if (LiveAPIStatus.live === true) {
1415
+ if (!await useMasterAndLiveRoomInfo(LiveType.StopBroadcast, LiveAPIStatus)) {
1398
1416
  await this.sendPrivateMsg("获取直播间信息失败,推送直播下播卡片失败!");
1399
1417
  return await this.sendPrivateMsgAndStopService();
1400
1418
  }
1401
- if (liveStatus.liveStartTimeInit) {
1402
- liveStatus.liveRoomInfo.live_time = liveStatus.liveStartTime;
1403
- liveStatus.liveStartTimeInit = false;
1419
+ if (LiveAPIStatus.liveStartTimeInit) {
1420
+ LiveAPIStatus.liveRoomInfo.live_time = LiveAPIStatus.liveStartTime;
1421
+ LiveAPIStatus.liveStartTimeInit = false;
1404
1422
  }
1405
1423
  const followerChange = (() => {
1406
- const liveFollowerChangeNum = liveStatus.masterInfo.liveFollowerChange;
1424
+ const liveFollowerChangeNum = LiveAPIStatus.masterInfo.liveFollowerChange;
1407
1425
  if (liveFollowerChangeNum > 0) return liveFollowerChangeNum >= 1e4 ? `+${liveFollowerChangeNum.toFixed(1)}万` : `+${liveFollowerChangeNum}`;
1408
1426
  return liveFollowerChangeNum <= -1e4 ? `${liveFollowerChangeNum.toFixed(1)}万` : liveFollowerChangeNum.toString();
1409
1427
  })();
1410
- const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", liveStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveStatus.liveStartTime)).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
1428
+ const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
1411
1429
  await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1412
- liveRoomInfo: liveStatus.liveRoomInfo,
1413
- masterInfo: liveStatus.masterInfo,
1430
+ liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1431
+ masterInfo: LiveAPIStatus.masterInfo,
1414
1432
  cardStyle: sub.customCardStyle
1415
- }, sub.uid, liveEndMsg);
1416
- liveStatus.live = false;
1433
+ }, uid, liveEndMsg);
1434
+ LiveAPIStatus.live = false;
1417
1435
  }
1418
1436
  break;
1419
1437
  }
1420
1438
  case 1: {
1421
- if (liveStatus.live === false) {
1422
- if (!await useMasterAndLiveRoomInfo(LiveType.StopBroadcast, liveStatus)) {
1439
+ if (LiveAPIStatus.live === false) {
1440
+ if (!await useMasterAndLiveRoomInfo(LiveType.StopBroadcast, LiveAPIStatus)) {
1423
1441
  await this.sendPrivateMsg("获取直播间信息失败,推送直播开播卡片失败!");
1424
1442
  return await this.sendPrivateMsgAndStopService();
1425
1443
  }
1426
- liveStatus.liveStartTime = liveStatus.liveRoomInfo.live_time;
1427
- liveStatus.liveStartTimeInit = true;
1428
- const follower = liveStatus.masterInfo.liveOpenFollowerNum >= 1e4 ? `${(liveStatus.masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : liveStatus.masterInfo.liveOpenFollowerNum.toString();
1429
- const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", liveStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveStatus.liveStartTime)).replace("-follower", follower).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveStatus.liveRoomInfo.short_id === 0 ? liveStatus.liveRoomInfo.room_id : liveStatus.liveRoomInfo.short_id}`);
1444
+ LiveAPIStatus.liveStartTime = LiveAPIStatus.liveRoomInfo.live_time;
1445
+ LiveAPIStatus.liveStartTimeInit = true;
1446
+ const follower = LiveAPIStatus.masterInfo.liveOpenFollowerNum >= 1e4 ? `${(LiveAPIStatus.masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : LiveAPIStatus.masterInfo.liveOpenFollowerNum.toString();
1447
+ const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower", follower).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
1430
1448
  await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1431
- liveRoomInfo: liveStatus.liveRoomInfo,
1432
- masterInfo: liveStatus.masterInfo,
1449
+ liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1450
+ masterInfo: LiveAPIStatus.masterInfo,
1433
1451
  cardStyle: sub.customCardStyle
1434
- }, sub.uid, liveStartMsg);
1435
- liveStatus.live = true;
1452
+ }, uid, liveStartMsg);
1453
+ LiveAPIStatus.live = true;
1436
1454
  }
1437
- if (liveStatus.live === true) {
1438
- if (liveStatus.push < this.config.pushTime * 60 * 60 / 30) {
1439
- liveStatus.push++;
1455
+ if (LiveAPIStatus.live === true) {
1456
+ if (LiveAPIStatus.push < this.config.pushTime * 60 * 60 / 30) {
1457
+ LiveAPIStatus.push++;
1440
1458
  break;
1441
1459
  }
1442
- if (!await useMasterAndLiveRoomInfo(LiveType.LiveBroadcast, liveStatus)) {
1460
+ if (!await useMasterAndLiveRoomInfo(LiveType.LiveBroadcast, LiveAPIStatus)) {
1443
1461
  await this.sendPrivateMsg("获取直播间信息失败,推送直播卡片失败!");
1444
1462
  return await this.sendPrivateMsgAndStopService();
1445
1463
  }
1446
- if (!liveStatus.liveStartTimeInit) {
1447
- liveStatus.liveStartTime = liveStatus.liveRoomInfo.live_time;
1448
- liveStatus.liveStartTimeInit = true;
1464
+ if (!LiveAPIStatus.liveStartTimeInit) {
1465
+ LiveAPIStatus.liveStartTime = LiveAPIStatus.liveRoomInfo.live_time;
1466
+ LiveAPIStatus.liveStartTimeInit = true;
1449
1467
  }
1450
- const liveMsg = liveMsgObj.customLive.replace("-name", liveStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveStatus.liveStartTime)).replace("-watched", "API模式无法获取").replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveStatus.liveRoomInfo.short_id === 0 ? liveStatus.liveRoomInfo.room_id : liveStatus.liveRoomInfo.short_id}`);
1468
+ const liveMsg = liveMsgObj.customLive.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-watched", "API模式无法获取").replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
1451
1469
  await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1452
- liveRoomInfo: liveStatus.liveRoomInfo,
1453
- masterInfo: liveStatus.masterInfo,
1470
+ liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1471
+ masterInfo: LiveAPIStatus.masterInfo,
1454
1472
  cardStyle: sub.customCardStyle
1455
- }, sub.uid, liveMsg);
1456
- liveStatus.push = 0;
1473
+ }, uid, liveMsg);
1474
+ LiveAPIStatus.push = 0;
1457
1475
  }
1458
1476
  break;
1459
1477
  }
@@ -1465,7 +1483,7 @@ var ComRegister = class {
1465
1483
  }
1466
1484
  subShow() {
1467
1485
  let table = "";
1468
- for (const sub of this.subManager) table += `UID:${sub.uid} ${sub.dynamic ? "已订阅动态" : ""} ${sub.live ? "已订阅直播" : ""}\n`;
1486
+ for (const [uid, sub] of this.subManager) table += `UID:${uid} ${sub.dynamic ? "已订阅动态" : ""} ${sub.live ? "已订阅直播" : ""}\n`;
1469
1487
  return table ? table : "没有订阅任何UP";
1470
1488
  }
1471
1489
  updateSubNotifier() {
@@ -1500,22 +1518,22 @@ var ComRegister = class {
1500
1518
  this.ctx.database.set("loginBili", 1, { dynamic_group_id: this.loginDBData.dynamic_group_id });
1501
1519
  return {
1502
1520
  code: 0,
1503
- msg: "分组已存在"
1521
+ message: "分组已存在"
1504
1522
  };
1505
1523
  }
1506
1524
  } else if (createGroupData.code !== 0) return {
1507
1525
  code: createGroupData.code,
1508
- msg: createGroupData.message
1526
+ message: createGroupData.message
1509
1527
  };
1510
1528
  this.ctx.database.set("loginBili", 1, { dynamic_group_id: createGroupData.data.tagid.toString() });
1511
1529
  return {
1512
1530
  code: createGroupData.code,
1513
- msg: createGroupData.message
1531
+ message: createGroupData.message
1514
1532
  };
1515
1533
  }
1516
1534
  return {
1517
1535
  code: 0,
1518
- msg: "分组已存在"
1536
+ message: "分组已存在"
1519
1537
  };
1520
1538
  };
1521
1539
  const resp = await checkGroupIsReady();
@@ -1531,93 +1549,105 @@ var ComRegister = class {
1531
1549
  }
1532
1550
  return {
1533
1551
  code: relationGroupDetailData.code,
1534
- msg: relationGroupDetailData.message,
1552
+ message: relationGroupDetailData.message,
1535
1553
  data: void 0
1536
1554
  };
1537
1555
  }
1538
1556
  return {
1539
1557
  code: 0,
1540
- msg: "获取分组明细成功",
1558
+ message: "获取分组明细成功",
1541
1559
  data: relationGroupDetailData.data
1542
1560
  };
1543
1561
  };
1544
- const { code, msg, data } = await getGroupDetailData();
1562
+ const { code, message, data } = await getGroupDetailData();
1545
1563
  if (code !== 0) return {
1546
1564
  code,
1547
- msg
1565
+ message
1548
1566
  };
1549
1567
  for (const user of data) if (user.mid === mid) return {
1550
1568
  code: 0,
1551
- msg: "订阅对象已存在于分组中"
1569
+ message: "订阅对象已存在于分组中"
1552
1570
  };
1553
1571
  const subUserData = await this.ctx["bilibili-notify-api"].follow(mid);
1554
1572
  const subUserMatchPattern = {
1555
1573
  [-101]: () => {
1556
1574
  return {
1557
1575
  code: subUserData.code,
1558
- msg: "账号未登录,请使用指令bili login登录后再进行订阅操作"
1576
+ message: "账号未登录,请使用指令bili login登录后再进行订阅操作"
1559
1577
  };
1560
1578
  },
1561
1579
  [-102]: () => {
1562
1580
  return {
1563
1581
  code: subUserData.code,
1564
- msg: "账号被封停,无法进行订阅操作"
1582
+ message: "账号被封停,无法进行订阅操作"
1565
1583
  };
1566
1584
  },
1567
1585
  22002: () => {
1568
1586
  return {
1569
1587
  code: subUserData.code,
1570
- msg: "因对方隐私设置,无法进行订阅操作"
1588
+ message: "因对方隐私设置,无法进行订阅操作"
1571
1589
  };
1572
1590
  },
1573
1591
  22003: () => {
1574
1592
  return {
1575
1593
  code: subUserData.code,
1576
- msg: "你已将对方拉黑,无法进行订阅操作"
1594
+ message: "你已将对方拉黑,无法进行订阅操作"
1577
1595
  };
1578
1596
  },
1579
1597
  22013: () => {
1580
1598
  return {
1581
1599
  code: subUserData.code,
1582
- msg: "账号已注销,无法进行订阅操作"
1600
+ message: "账号已注销,无法进行订阅操作"
1583
1601
  };
1584
1602
  },
1585
1603
  40061: () => {
1586
1604
  return {
1587
1605
  code: subUserData.code,
1588
- msg: "账号不存在,请检查uid输入是否正确或用户是否存在"
1606
+ message: "账号不存在,请检查uid输入是否正确或用户是否存在"
1589
1607
  };
1590
1608
  },
1591
1609
  22001: () => {
1592
1610
  return {
1593
1611
  code: 0,
1594
- msg: "订阅对象为自己,无需添加到分组"
1612
+ message: "订阅对象为自己,无需添加到分组"
1595
1613
  };
1596
1614
  },
1597
1615
  22014: async () => {
1598
1616
  const copyUserToGroupData = await this.ctx["bilibili-notify-api"].copyUserToGroup(mid, this.loginDBData.dynamic_group_id);
1599
1617
  if (copyUserToGroupData.code !== 0) return {
1600
1618
  code: copyUserToGroupData.code,
1601
- msg: "添加订阅对象到分组失败,请稍后重试"
1619
+ message: "添加订阅对象到分组失败,请稍后重试"
1602
1620
  };
1603
1621
  return {
1604
1622
  code: 0,
1605
- msg: "订阅对象添加成功"
1623
+ message: "订阅对象添加成功"
1624
+ };
1625
+ },
1626
+ 22015: async () => {
1627
+ return {
1628
+ code: subUserData.code,
1629
+ message: subUserData.message
1606
1630
  };
1607
1631
  },
1608
1632
  0: async () => {
1609
1633
  const copyUserToGroupData = await this.ctx["bilibili-notify-api"].copyUserToGroup(mid, this.loginDBData.dynamic_group_id);
1610
1634
  if (copyUserToGroupData.code !== 0) return {
1611
1635
  code: copyUserToGroupData.code,
1612
- msg: "添加订阅对象到分组失败,请稍后重试"
1636
+ message: "添加订阅对象到分组失败,请稍后重试"
1613
1637
  };
1614
1638
  return {
1615
1639
  code: 0,
1616
- msg: "订阅对象添加成功"
1640
+ message: "订阅对象添加成功"
1617
1641
  };
1618
1642
  }
1619
1643
  };
1620
- return await subUserMatchPattern[subUserData.code]();
1644
+ const subUserExecute = subUserMatchPattern[subUserData.code] || (() => {
1645
+ return {
1646
+ code: subUserData.code,
1647
+ message: subUserData.message
1648
+ };
1649
+ });
1650
+ return await subUserExecute();
1621
1651
  }
1622
1652
  async loadSubFromConfig(subs) {
1623
1653
  this.preInitConfig(subs);
@@ -1625,11 +1655,8 @@ var ComRegister = class {
1625
1655
  this.logger.info(`加载订阅UID:${sub.uid}中...`);
1626
1656
  const { code: userInfoCode, message: userInfoMsg, data: userInfoData } = await withRetry(async () => {
1627
1657
  const data = await this.ctx["bilibili-notify-api"].getUserInfo(sub.uid);
1628
- return {
1629
- code: 0,
1630
- data
1631
- };
1632
- }).then((content) => content.data).catch((e) => {
1658
+ return data;
1659
+ }).catch((e) => {
1633
1660
  this.logger.error(`loadSubFromConfig() getUserInfo() 发生了错误,错误为:${e.message}`);
1634
1661
  return {
1635
1662
  code: -1,
@@ -1641,12 +1668,12 @@ var ComRegister = class {
1641
1668
  await this.sendPrivateMsg("账号被风控,请使用指令 bili cap 进行风控验证");
1642
1669
  return {
1643
1670
  code: userInfoCode,
1644
- msg: userInfoMsg
1671
+ message: userInfoMsg
1645
1672
  };
1646
1673
  }
1647
1674
  if (userInfoCode !== 0) return {
1648
1675
  code: userInfoCode,
1649
- msg: userInfoMsg
1676
+ message: userInfoMsg
1650
1677
  };
1651
1678
  if (this.config.liveDetectType === "WS" && sub.live) {
1652
1679
  if (!userInfoData.live_room) {
@@ -1657,8 +1684,7 @@ var ComRegister = class {
1657
1684
  }
1658
1685
  const subInfo = await this.subUserInBili(sub.uid);
1659
1686
  if (subInfo.code !== 0) return subInfo;
1660
- this.subManager.push({
1661
- uid: sub.uid,
1687
+ this.subManager.set(sub.uid, {
1662
1688
  uname: userInfoData.name,
1663
1689
  roomId: sub.live ? userInfoData.live_room.roomid : "",
1664
1690
  target: sub.target,
@@ -1677,7 +1703,7 @@ var ComRegister = class {
1677
1703
  }
1678
1704
  return {
1679
1705
  code: 0,
1680
- msg: "订阅加载完毕!"
1706
+ message: "订阅加载完毕!"
1681
1707
  };
1682
1708
  }
1683
1709
  checkIfDynamicDetectIsNeeded() {
@@ -1685,7 +1711,7 @@ var ComRegister = class {
1685
1711
  }
1686
1712
  checkIfLiveDetectIsNeeded() {
1687
1713
  if (this.config.liveDetectType === "API") {
1688
- if (this.liveStatusManager.size > 0) this.enableLiveDetect();
1714
+ if (this.liveAPIManager.size > 0) this.enableLiveDetect();
1689
1715
  }
1690
1716
  }
1691
1717
  enableDynamicDetect() {
@@ -1694,9 +1720,9 @@ var ComRegister = class {
1694
1720
  this.dynamicJob.start();
1695
1721
  }
1696
1722
  async enableLiveDetect() {
1697
- this.liveJob = new cron.CronJob("*/30 * * * * *", await this.liveDetectWithAPI());
1723
+ this.liveAPIJob = new cron.CronJob("*/30 * * * * *", await this.liveDetectWithAPI());
1698
1724
  this.logger.info("直播监测已开启");
1699
- this.liveJob.start();
1725
+ this.liveAPIJob.start();
1700
1726
  }
1701
1727
  async checkIfIsLogin() {
1702
1728
  if ((await this.ctx.database.get("loginBili", 1)).length !== 0) {