koishi-plugin-bilibili-notify 3.1.0-alpha.1 → 3.1.1-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.
@@ -1,7 +1,7 @@
1
1
  import { type Bot, type Context, type FlatPick, type Logger, Schema } from "koishi";
2
2
  import type { Notifier } from "@koishijs/plugin-notifier";
3
3
  import type { LoginBili } from "./database";
4
- import { LiveType, type MasterInfo, type SubItem, type SubManager, type Target } from "./type";
4
+ import { LiveType, type MasterInfo, PushType, type SubItem, type SubManager, type Target } from "./type";
5
5
  declare class ComRegister {
6
6
  static inject: string[];
7
7
  qqRelatedBotList: Array<string>;
@@ -24,7 +24,7 @@ declare class ComRegister {
24
24
  sendPrivateMsgAndRebootService(): Promise<void>;
25
25
  sendPrivateMsgAndStopService(): Promise<void>;
26
26
  sendMessageWithRetry(bot: Bot<Context>, channelId: string, content: any): Promise<void>;
27
- broadcastToTargets(targets: Target, content: any, live?: boolean): Promise<void>;
27
+ broadcastToTargets(targets: Target, content: any, type: PushType): Promise<void>;
28
28
  dynamicDetect(): (...args: any[]) => void;
29
29
  debug_dynamicDetect(): (...args: any[]) => void;
30
30
  useMasterInfo(uid: string, masterInfo: MasterInfo, liveType: LiveType): Promise<MasterInfo>;
@@ -73,7 +73,6 @@ declare namespace ComRegister {
73
73
  masterAccount: string;
74
74
  masterAccountGuildId: string;
75
75
  };
76
- liveDetectMode: "API" | "WS";
77
76
  restartPush: boolean;
78
77
  pushTime: number;
79
78
  pushImgsInDynamic: boolean;
@@ -423,7 +423,7 @@ class ComRegister {
423
423
  });
424
424
  }
425
425
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
426
- async broadcastToTargets(targets, content, live) {
426
+ async broadcastToTargets(targets, content, type) {
427
427
  for (const target of targets) {
428
428
  // 获取机器人实例
429
429
  const bot = this.getBot(target.platform);
@@ -445,33 +445,57 @@ class ComRegister {
445
445
  else {
446
446
  channelArr = target.channelArr;
447
447
  }
448
- // 判断是否是直播开播推送,如果是则需要进一步判断是否需要艾特群体成员
449
- if (live) {
450
- // 直播开播推送,判断是否需要艾特全体成员
451
- for (const channel of channelArr) {
452
- // 判断是否需要推送直播消息
453
- if (channel.live) {
454
- await this.sendMessageWithRetry(bot, channel.channelId, content);
448
+ // 模式匹配
449
+ const pushTypePatternMatching = {
450
+ [type_1.PushType.Live]: async () => {
451
+ for (const channel of channelArr) {
452
+ // 判断是否需要推送动态消息
453
+ if (channel.live) {
454
+ await this.sendMessageWithRetry(bot, channel.channelId, content);
455
+ }
456
+ // 延迟发送
457
+ await this.ctx.sleep(500);
455
458
  }
456
- // 判断是否需要艾特全体成员
457
- if (channel.atAll) {
458
- await this.sendMessageWithRetry(bot, channel.channelId, (0, jsx_runtime_1.jsx)("at", { type: "all" }));
459
+ },
460
+ [type_1.PushType.Dynamic]: async () => {
461
+ for (const channel of channelArr) {
462
+ // 判断是否需要推送动态消息
463
+ if (channel.live) {
464
+ await this.sendMessageWithRetry(bot, channel.channelId, content);
465
+ }
466
+ // 延迟发送
467
+ await this.ctx.sleep(500);
459
468
  }
460
- // 延迟发送
461
- await this.ctx.sleep(500);
462
- }
463
- }
464
- else {
465
- // 不是直播开播推送
466
- for (const channel of channelArr) {
467
- // 判断是否需要推送动态消息
468
- if (channel.dynamic || channel.live) {
469
- await this.sendMessageWithRetry(bot, channel.channelId, content);
469
+ },
470
+ [type_1.PushType.StartBroadcasting]: async () => {
471
+ // 直播开播推送,判断是否需要艾特全体成员
472
+ for (const channel of channelArr) {
473
+ // 判断是否需要推送直播消息
474
+ if (channel.live) {
475
+ await this.sendMessageWithRetry(bot, channel.channelId, content);
476
+ }
477
+ // 判断是否需要艾特全体成员
478
+ if (channel.atAll) {
479
+ await this.sendMessageWithRetry(bot, channel.channelId, (0, jsx_runtime_1.jsx)("at", { type: "all" }));
480
+ }
481
+ // 延迟发送
482
+ await this.ctx.sleep(500);
470
483
  }
471
- // 延迟发送
472
- await this.ctx.sleep(500);
473
- }
474
- }
484
+ },
485
+ [type_1.PushType.LiveGuardBuy]: async () => {
486
+ // 直播守护购买推送,判断是否需要艾特全体成员
487
+ for (const channel of channelArr) {
488
+ // 判断是否需要推送直播消息
489
+ if (channel.liveGuardBuy) {
490
+ await this.sendMessageWithRetry(bot, channel.channelId, content);
491
+ }
492
+ // 延迟发送
493
+ await this.ctx.sleep(500);
494
+ }
495
+ },
496
+ };
497
+ // 推送
498
+ await pushTypePatternMatching[type]();
475
499
  }
476
500
  }
477
501
  dynamicDetect() {
@@ -580,67 +604,71 @@ class ComRegister {
580
604
  // 动态ID如果一致则结束循环
581
605
  if (dynamicId === dynamicIdStr1st)
582
606
  break;
583
- // 判断动态时间戳是否大于时间线
584
- if (item.modules.module_author.pub_ts > timeline) {
585
- // 从动态数据中取出UP主名称、UID
586
- const upUID = item.modules.module_author.mid.toString();
587
- const upName = item.modules.module_author.name;
588
- // 寻找关注的UP主的动态
589
- for (const sub of this.subManager) {
590
- // 判断是否是订阅的UP主
591
- if (sub.dynamic && sub.uid === upUID) {
592
- // 订阅该UP主,推送该动态
593
- // 推送该条动态
594
- const buffer = await (0, utils_1.withRetry)(async () => {
595
- // 渲染图片
596
- return await this.ctx.gi.generateDynamicImg(item, sub.card);
597
- }, 1).catch(async (e) => {
598
- // 直播开播动态,不做处理
599
- if (e.message === "直播开播动态,不做处理")
600
- return;
601
- if (e.message === "出现关键词,屏蔽该动态") {
602
- // 如果需要发送才发送
603
- if (this.config.filter.notify) {
604
- await this.broadcastToTargets(sub.target, `${upName}发布了一条含有屏蔽关键字的动态`);
605
- }
606
- return;
607
+ // 获取动态发布时间
608
+ const postTime = item.modules.module_author.pub_ts;
609
+ // timeline已超过或与当前动态时间戳相同,则后面的动态不需要推送
610
+ if (postTime <= timeline)
611
+ break;
612
+ // 从动态数据中取出UP主名称、UID
613
+ const upUID = item.modules.module_author.mid.toString();
614
+ const upName = item.modules.module_author.name;
615
+ // 寻找关注的UP主的动态
616
+ for (const sub of this.subManager) {
617
+ // 判断是否是订阅的UP主
618
+ if (sub.dynamic && sub.uid === upUID) {
619
+ // 推送该条动态
620
+ const buffer = await (0, utils_1.withRetry)(async () => {
621
+ // 渲染图片
622
+ return await this.ctx.gi.generateDynamicImg(item, sub.card);
623
+ }, 1).catch(async (e) => {
624
+ // 直播开播动态,不做处理
625
+ if (e.message === "直播开播动态,不做处理")
626
+ return;
627
+ if (e.message === "出现关键词,屏蔽该动态") {
628
+ // 如果需要发送才发送
629
+ if (this.config.filter.notify) {
630
+ await this.broadcastToTargets(sub.target, `${upName}发布了一条含有屏蔽关键字的动态`, type_1.PushType.Dynamic);
607
631
  }
608
- if (e.message === "已屏蔽转发动态") {
609
- if (this.config.filter.notify) {
610
- await this.broadcastToTargets(sub.target, `${upName}转发了一条动态,已屏蔽`);
611
- }
612
- return;
632
+ return;
633
+ }
634
+ if (e.message === "已屏蔽转发动态") {
635
+ if (this.config.filter.notify) {
636
+ await this.broadcastToTargets(sub.target, `${upName}转发了一条动态,已屏蔽`, type_1.PushType.Dynamic);
613
637
  }
614
- // 未知错误
615
- this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
616
- // 发送私聊消息并重启服务
617
- await this.sendPrivateMsgAndStopService();
618
- });
619
- // 判断是否执行成功,未执行成功直接返回
620
- if (!buffer)
621
- continue;
622
- // 判断是否需要发送URL
623
- const dUrl = this.config.dynamicUrl
624
- ? `${upName}发布了一条动态:https://t.bilibili.com/${dynamicId}`
625
- : "";
626
- // logger
627
- this.logger.info("推送动态中...");
628
- // 发送推送卡片
629
- await this.broadcastToTargets(sub.target, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, "image/jpeg"), dUrl] }));
630
- // 判断是否需要发送动态中的图片
631
- if (this.config.pushImgsInDynamic) {
632
- // 判断是否为图文动态,且存在draw
633
- if (item.type === "DYNAMIC_TYPE_DRAW" &&
634
- item.modules.module_dynamic.major?.draw) {
635
- for (const img of item.modules.module_dynamic.major.draw
636
- .items) {
637
- await this.broadcastToTargets(sub.target, (0, jsx_runtime_1.jsx)("img", { src: img.src, alt: "\u52A8\u6001\u56FE\u7247" }));
638
- }
638
+ return;
639
+ }
640
+ // 未知错误
641
+ this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
642
+ // 发送私聊消息并重启服务
643
+ await this.sendPrivateMsgAndStopService();
644
+ });
645
+ // 判断是否执行成功,未执行成功直接返回
646
+ if (!buffer)
647
+ continue;
648
+ // 定义动态链接
649
+ let dUrl = "";
650
+ // 判断是否需要发送URL
651
+ if (this.config.dynamicUrl) {
652
+ // 生成动态链接
653
+ dUrl = `${upName}发布了一条动态:https://t.bilibili.com/${dynamicId}`;
654
+ }
655
+ // logger
656
+ this.logger.info("推送动态中...");
657
+ // 发送推送卡片
658
+ await this.broadcastToTargets(sub.target, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, "image/jpeg"), dUrl] }), type_1.PushType.Dynamic);
659
+ // 判断是否需要发送动态中的图片
660
+ if (this.config.pushImgsInDynamic) {
661
+ // 判断是否为图文动态,且存在draw
662
+ if (item.type === "DYNAMIC_TYPE_DRAW" &&
663
+ item.modules.module_dynamic.major?.draw) {
664
+ for (const img of item.modules.module_dynamic.major.draw
665
+ .items) {
666
+ await this.broadcastToTargets(sub.target, (0, jsx_runtime_1.jsx)("img", { src: img.src, alt: "\u52A8\u6001\u56FE\u7247" }), type_1.PushType.Dynamic);
639
667
  }
640
668
  }
641
- // logger
642
- this.logger.info("动态推送完毕!");
643
669
  }
670
+ // logger
671
+ this.logger.info("动态推送完毕!");
644
672
  }
645
673
  }
646
674
  }
@@ -788,93 +816,104 @@ class ComRegister {
788
816
  this.logger.info("动态ID与上一次获取第一条一致,结束循环");
789
817
  break;
790
818
  }
819
+ // 获取动态发布时间
820
+ const postTime = item.modules.module_author.pub_ts;
821
+ // logger
822
+ this.logger.info(`当前动态时间线:${postTime}`);
791
823
  // logger
792
- this.logger.info(`当前动态时间线:${item.modules.module_author.pub_ts}`);
793
824
  this.logger.info(`上一次获取到第一条动态时间线:${timeline}`);
794
- // 判断动态时间戳是否大于时间线
795
- if (item.modules.module_author.pub_ts > timeline) {
796
- // logger
797
- this.logger.info("动态时间线大于上一次获取到第一条动态时间线,开始判断是否是订阅的UP主...");
798
- // 从动态数据中取出UP主名称、UID
799
- const upUID = item.modules.module_author.mid.toString();
800
- const upName = item.modules.module_author.name;
825
+ // logger
826
+ this.logger.info(`当前动态发布时间:${luxon_1.DateTime.fromSeconds(postTime).toFormat("yyyy-MM-dd HH:mm:ss")}`);
827
+ // logger
828
+ this.logger.info(`上一次获取到第一条动态发布时间:${luxon_1.DateTime.fromSeconds(timeline).toFormat("yyyy-MM-dd HH:mm:ss")}`);
829
+ // timeline已超过或与当前动态时间戳相同,则后面的动态不需要推送
830
+ if (postTime <= timeline) {
801
831
  // logger
802
- this.logger.info(`当前动态UP主UID:${upUID},UP主名称:${upName}`);
803
- // 寻找关注的UP主的动态
804
- for (const sub of this.subManager) {
805
- // 判断是否是订阅的UP主
806
- if (sub.dynamic && sub.uid === upUID) {
807
- // logger:订阅该UP主,推送该动态
808
- this.logger.info("订阅该UP主,开始推送该动态...");
809
- // logger
810
- this.logger.info("开始生成推送卡片...");
811
- // 推送该条动态
812
- const buffer = await (0, utils_1.withRetry)(async () => {
813
- // 渲染图片
814
- return await this.ctx.gi.generateDynamicImg(item, sub.card);
815
- }, 1).catch(async (e) => {
816
- // 直播开播动态,不做处理
817
- if (e.message === "直播开播动态,不做处理")
818
- return;
819
- if (e.message === "出现关键词,屏蔽该动态") {
820
- // 如果需要发送才发送
821
- if (this.config.filter.notify) {
822
- await this.broadcastToTargets(sub.target, `${upName}发布了一条含有屏蔽关键字的动态`);
823
- }
824
- return;
825
- }
826
- if (e.message === "已屏蔽转发动态") {
827
- if (this.config.filter.notify) {
828
- await this.broadcastToTargets(sub.target, `${upName}转发了一条动态,已屏蔽`);
829
- }
830
- return;
832
+ this.logger.info("当前动态时间戳已小于等于上一次获取到第一条动态时间线,更晚发布的动态无需监测");
833
+ // 结束本次监测
834
+ break;
835
+ }
836
+ // logger
837
+ this.logger.info("动态时间线大于上一次获取到第一条动态时间线,开始判断是否是订阅的UP主...");
838
+ // 从动态数据中取出UP主名称、UID
839
+ const upUID = item.modules.module_author.mid.toString();
840
+ const upName = item.modules.module_author.name;
841
+ // logger
842
+ this.logger.info(`当前动态UP主UID:${upUID},UP主名称:${upName}`);
843
+ // 寻找关注的UP主的动态
844
+ for (const sub of this.subManager) {
845
+ // 判断是否是订阅的UP主
846
+ if (sub.dynamic && sub.uid === upUID) {
847
+ // logger:订阅该UP主,推送该动态
848
+ this.logger.info("订阅该UP主,开始推送该动态...");
849
+ // logger
850
+ this.logger.info("开始生成推送卡片...");
851
+ // 推送该条动态
852
+ const buffer = await (0, utils_1.withRetry)(async () => {
853
+ // 渲染图片
854
+ return await this.ctx.gi.generateDynamicImg(item, sub.card);
855
+ }, 1).catch(async (e) => {
856
+ // 直播开播动态,不做处理
857
+ if (e.message === "直播开播动态,不做处理")
858
+ return;
859
+ if (e.message === "出现关键词,屏蔽该动态") {
860
+ // 如果需要发送才发送
861
+ if (this.config.filter.notify) {
862
+ await this.broadcastToTargets(sub.target, `${upName}发布了一条含有屏蔽关键字的动态`, type_1.PushType.Dynamic);
831
863
  }
832
- // 未知错误
833
- this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
834
- // 发送私聊消息并重启服务
835
- await this.sendPrivateMsgAndStopService();
836
- });
837
- // 判断是否执行成功,未执行成功直接返回
838
- if (!buffer) {
839
- // logger
840
- this.logger.info("推送卡片生成失败,或该动态为屏蔽动态,跳过该动态!");
841
- // 结束循环
842
- continue;
864
+ return;
843
865
  }
844
- // 定义动态链接
845
- let dUrl = "";
846
- // 判断是否需要发送URL
847
- if (this.config.dynamicUrl) {
848
- // logger
849
- this.logger.info("生成动态链接中...");
850
- // 生成动态链接
851
- dUrl = `${upName}发布了一条动态:https://t.bilibili.com/${dynamicId}`;
866
+ if (e.message === "已屏蔽转发动态") {
867
+ if (this.config.filter.notify) {
868
+ await this.broadcastToTargets(sub.target, `${upName}转发了一条动态,已屏蔽`, type_1.PushType.Dynamic);
869
+ }
870
+ return;
852
871
  }
872
+ // 未知错误
873
+ this.logger.error(`dynamicDetect generateDynamicImg() 推送卡片发送失败,原因:${e.message}`);
874
+ // 发送私聊消息并重启服务
875
+ await this.sendPrivateMsgAndStopService();
876
+ });
877
+ // 判断是否执行成功,未执行成功直接返回
878
+ if (!buffer) {
853
879
  // logger
854
- this.logger.info("推送动态中...");
855
- // 发送推送卡片
856
- await this.broadcastToTargets(sub.target, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, "image/jpeg"), dUrl] }));
880
+ this.logger.info("推送卡片生成失败,或该动态为屏蔽动态,跳过该动态!");
881
+ // 结束循环
882
+ continue;
883
+ }
884
+ // 定义动态链接
885
+ let dUrl = "";
886
+ // 判断是否需要发送URL
887
+ if (this.config.dynamicUrl) {
857
888
  // logger
858
- this.logger.info("动态推送完毕!");
859
- // 判断是否需要发送动态中的图片
860
- if (this.config.pushImgsInDynamic) {
861
- // logger
862
- this.logger.info("开始推送动态中的图片...");
863
- // 判断是否为图文动态,且存在draw
864
- if (item.type === "DYNAMIC_TYPE_DRAW" &&
865
- item.modules.module_dynamic.major?.draw) {
866
- for (const img of item.modules.module_dynamic.major.draw
867
- .items) {
868
- await this.broadcastToTargets(sub.target, (0, jsx_runtime_1.jsx)("img", { src: img.src, alt: "\u52A8\u6001\u56FE\u7247" }));
869
- }
889
+ this.logger.info("生成动态链接中...");
890
+ // 生成动态链接
891
+ dUrl = `${upName}发布了一条动态:https://t.bilibili.com/${dynamicId}`;
892
+ }
893
+ // logger
894
+ this.logger.info("推送动态中...");
895
+ // 发送推送卡片
896
+ await this.broadcastToTargets(sub.target, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, "image/jpeg"), dUrl] }), type_1.PushType.Dynamic);
897
+ // 判断是否需要发送动态中的图片
898
+ if (this.config.pushImgsInDynamic) {
899
+ // logger
900
+ this.logger.info("开始推送动态中的图片...");
901
+ // 判断是否为图文动态,且存在draw
902
+ if (item.type === "DYNAMIC_TYPE_DRAW" &&
903
+ item.modules.module_dynamic.major?.draw) {
904
+ for (const img of item.modules.module_dynamic.major.draw
905
+ .items) {
906
+ await this.broadcastToTargets(sub.target, (0, jsx_runtime_1.jsx)("img", { src: img.src, alt: "\u52A8\u6001\u56FE\u7247" }), type_1.PushType.Dynamic);
870
907
  }
871
- // logger
872
- this.logger.info("图片推送完毕!");
873
908
  }
874
909
  // logger
875
- this.logger.info("动态推送完毕!");
910
+ this.logger.info("图片推送完毕!");
876
911
  }
912
+ // logger
913
+ this.logger.info("动态推送完毕!");
877
914
  }
915
+ // logger
916
+ this.logger.info("不是关注的UP主,跳过该动态");
878
917
  }
879
918
  }
880
919
  // 更新本次请求第一条动态的动态ID
@@ -886,6 +925,10 @@ class ComRegister {
886
925
  items[0].modules.module_author.pub_ts || luxon_1.DateTime.now().toSeconds();
887
926
  // logger
888
927
  this.logger.info(`更新时间线:${timeline}`);
928
+ // logger
929
+ this.logger.info(`时间线格式化:${luxon_1.DateTime.fromSeconds(timeline).toFormat("yyyy-MM-dd HH:mm:ss")}`);
930
+ // logger
931
+ this.logger.info("动态监测完成,等待下一次检测...");
889
932
  };
890
933
  // 返回一个闭包函数
891
934
  return (0, utils_1.withLock)(handler);
@@ -974,7 +1017,9 @@ class ComRegister {
974
1017
  // 推送直播信息
975
1018
  const msg = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, "image/jpeg"), liveNotifyMsg || ""] }));
976
1019
  // 只有在开播时才艾特全体成员
977
- return await this.broadcastToTargets(target, msg, liveType === type_1.LiveType.StartBroadcasting);
1020
+ return await this.broadcastToTargets(target, msg, liveType === type_1.LiveType.StartBroadcasting
1021
+ ? type_1.PushType.StartBroadcasting
1022
+ : type_1.PushType.Live);
978
1023
  };
979
1024
  // 找到频道/群组对应的
980
1025
  const liveGuardBuyPushTargetArr = target.map((channel) => {
@@ -1058,7 +1103,7 @@ class ComRegister {
1058
1103
  const content = `[${masterInfo.username}的直播间]「${body.user.uname}」加入了大航海(${body.gift_name})`;
1059
1104
  // 直接发送消息
1060
1105
  channelArrLen > 0 &&
1061
- this.broadcastToTargets(liveGuardBuyPushTargetArr, content);
1106
+ this.broadcastToTargets(liveGuardBuyPushTargetArr, content, type_1.PushType.LiveGuardBuy);
1062
1107
  },
1063
1108
  onLiveStart: async () => {
1064
1109
  // 判断是否已经开播
@@ -1528,10 +1573,6 @@ class ComRegister {
1528
1573
  masterAccount: koishi_1.Schema.string(),
1529
1574
  masterAccountGuildId: koishi_1.Schema.string(),
1530
1575
  }),
1531
- liveDetectMode: koishi_1.Schema.union([
1532
- koishi_1.Schema.const("API"),
1533
- koishi_1.Schema.const("WS"),
1534
- ]).required(),
1535
1576
  restartPush: koishi_1.Schema.boolean().required(),
1536
1577
  pushTime: koishi_1.Schema.number().required(),
1537
1578
  pushImgsInDynamic: koishi_1.Schema.boolean().required(),
package/lib/index.d.ts CHANGED
@@ -44,7 +44,6 @@ export interface Config {
44
44
  dynamicUrl: boolean;
45
45
  pushImgsInDynamic: boolean;
46
46
  live: {};
47
- liveDetectMode: "API" | "WS";
48
47
  restartPush: boolean;
49
48
  pushTime: number;
50
49
  customLiveStart: string;
package/lib/index.js CHANGED
@@ -127,7 +127,6 @@ class ServerManager extends koishi_1.Service {
127
127
  subLoadTimeout: globalConfig.subLoadTimeout,
128
128
  sub: globalConfig.sub,
129
129
  master: globalConfig.master,
130
- liveDetectMode: globalConfig.liveDetectMode,
131
130
  restartPush: globalConfig.restartPush,
132
131
  pushTime: globalConfig.pushTime,
133
132
  pushImgsInDynamic: globalConfig.pushImgsInDynamic,
@@ -196,7 +195,7 @@ function apply(ctx, config) {
196
195
  // 设置提示
197
196
  ctx.notifier.create({
198
197
  type: "danger",
199
- content: "从3.1.0-alpha.0及以前版本升级到3.1.0-alpha.1版本必定报错,请重新填写订阅配置中sub.target.channelArr的内容",
198
+ content: "从3.1.0-alpha.0及以前版本升级到3.1.0-alpha.1及以后版本必定报错,请重新填写订阅配置中sub.target.channelArr的内容",
200
199
  });
201
200
  ctx.notifier.create({
202
201
  type: "warning",
@@ -325,15 +324,6 @@ exports.Config = koishi_1.Schema.object({
325
324
  .default(false)
326
325
  .description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片"),
327
326
  live: koishi_1.Schema.object({}).description("直播推送设置"),
328
- liveDetectMode: koishi_1.Schema.union([
329
- koishi_1.Schema.const("WS").description("WebSocket模式:连接到对应的直播间,可推送弹幕消息,开播下播响应最快,但对订阅数有限制"),
330
- koishi_1.Schema.const("API")
331
- .description("API模式:请求对应直播间API,无法获取弹幕消息,开播下播响应慢,理论可无限订阅")
332
- .deprecated(),
333
- ])
334
- .role("radio")
335
- .description("直播检测模式")
336
- .default("WS"),
337
327
  restartPush: koishi_1.Schema.boolean()
338
328
  .default(true)
339
329
  .description("插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启"),
@@ -89,3 +89,9 @@ export type AllDynamicInfo = {
89
89
  update_num: number;
90
90
  };
91
91
  };
92
+ export declare enum PushType {
93
+ Live = 0,
94
+ Dynamic = 1,
95
+ StartBroadcasting = 2,
96
+ LiveGuardBuy = 3
97
+ }
package/lib/type/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LiveType = void 0;
3
+ exports.PushType = exports.LiveType = void 0;
4
4
  var LiveType;
5
5
  (function (LiveType) {
6
6
  LiveType[LiveType["NotLiveBroadcast"] = 0] = "NotLiveBroadcast";
@@ -9,3 +9,10 @@ var LiveType;
9
9
  LiveType[LiveType["StopBroadcast"] = 3] = "StopBroadcast";
10
10
  LiveType[LiveType["FirstLiveBroadcast"] = 4] = "FirstLiveBroadcast";
11
11
  })(LiveType || (exports.LiveType = LiveType = {}));
12
+ var PushType;
13
+ (function (PushType) {
14
+ PushType[PushType["Live"] = 0] = "Live";
15
+ PushType[PushType["Dynamic"] = 1] = "Dynamic";
16
+ PushType[PushType["StartBroadcasting"] = 2] = "StartBroadcasting";
17
+ PushType[PushType["LiveGuardBuy"] = 3] = "LiveGuardBuy";
18
+ })(PushType || (exports.PushType = PushType = {}));
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.1.0-alpha.1",
4
+ "version": "3.1.1-alpha.0",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -232,6 +232,8 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
232
232
  - ver 3.0.5-alpha.2 优化:移除多余依赖
233
233
  - ver 3.1.0-alpha.0 修复:新插件在第一次订阅时提示 `订阅失败,错误信息:该分组已经存在`; 移除:消息重发功能; 重构:将消息发送模式改为 `broadcast`
234
234
  - ver 3.1.0-alpha.1 修复:无法发送 `@全体成员` 消息,将消息发送模式改回
235
+ - ver 3.1.0 修复:订阅某位UP主直播和动态后,某些群聊只开启推送直播也会推送动态
236
+ - ver 3.1.1-alpha.0 修复:稿件重投后,会将之前日期的动态一起推送; 优化:加强动态debug输出; 移除:不必要选项 `live.liveDetectMode`
235
237
 
236
238
  ## 交流群
237
239