koishi-plugin-bilibili-notify 3.3.1-alpha.0 → 3.3.1-alpha.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.d.mts CHANGED
@@ -18,6 +18,7 @@ interface BAConfig {
18
18
  liveAtAll: boolean;
19
19
  liveGuardBuy: boolean;
20
20
  wordcloud: boolean;
21
+ liveSummary: boolean;
21
22
  platform: string;
22
23
  target: string;
23
24
  }>;
@@ -59,6 +60,7 @@ type Channel = {
59
60
  liveAtAll: boolean;
60
61
  liveGuardBuy: boolean;
61
62
  wordcloud: boolean;
63
+ liveSummary: boolean;
62
64
  bot: string;
63
65
  };
64
66
  type ChannelArr = Array<Channel>;
@@ -67,20 +69,20 @@ type TargetItem = {
67
69
  platform: string;
68
70
  };
69
71
  type Target = Array<TargetItem>;
70
- type SubCard = {
72
+ type CustomCardStyle = {
71
73
  enable: boolean;
72
74
  cardColorStart?: string;
73
75
  cardColorEnd?: string;
74
76
  cardBasePlateColor?: string;
75
77
  cardBasePlateBorder?: string;
76
78
  };
77
- type SubLiveMsg = {
79
+ type CustomLiveMsg = {
78
80
  enable: boolean;
79
81
  customLiveStart?: string;
80
82
  customLive?: string;
81
83
  customLiveEnd?: string;
82
84
  };
83
- type SubLiveSummary = {
85
+ type CustomLiveSummary = {
84
86
  enable: boolean;
85
87
  liveSummary?: string;
86
88
  };
@@ -88,11 +90,10 @@ type Subscription = {
88
90
  uid: string;
89
91
  dynamic: boolean;
90
92
  live: boolean;
91
- wordcloud: boolean;
92
93
  target: Target;
93
- card: SubCard;
94
- liveMsg: SubLiveMsg;
95
- liveSummary: SubLiveSummary;
94
+ customCardStyle: CustomCardStyle;
95
+ customLiveMsg: CustomLiveMsg;
96
+ customLiveSummary: CustomLiveSummary;
96
97
  };
97
98
  type Subscriptions = Record<string, Subscription>;
98
99
  //#endregion
package/lib/index.d.ts CHANGED
@@ -18,6 +18,7 @@ interface BAConfig {
18
18
  liveAtAll: boolean;
19
19
  liveGuardBuy: boolean;
20
20
  wordcloud: boolean;
21
+ liveSummary: boolean;
21
22
  platform: string;
22
23
  target: string;
23
24
  }>;
@@ -59,6 +60,7 @@ type Channel = {
59
60
  liveAtAll: boolean;
60
61
  liveGuardBuy: boolean;
61
62
  wordcloud: boolean;
63
+ liveSummary: boolean;
62
64
  bot: string;
63
65
  };
64
66
  type ChannelArr = Array<Channel>;
@@ -67,20 +69,20 @@ type TargetItem = {
67
69
  platform: string;
68
70
  };
69
71
  type Target = Array<TargetItem>;
70
- type SubCard = {
72
+ type CustomCardStyle = {
71
73
  enable: boolean;
72
74
  cardColorStart?: string;
73
75
  cardColorEnd?: string;
74
76
  cardBasePlateColor?: string;
75
77
  cardBasePlateBorder?: string;
76
78
  };
77
- type SubLiveMsg = {
79
+ type CustomLiveMsg = {
78
80
  enable: boolean;
79
81
  customLiveStart?: string;
80
82
  customLive?: string;
81
83
  customLiveEnd?: string;
82
84
  };
83
- type SubLiveSummary = {
85
+ type CustomLiveSummary = {
84
86
  enable: boolean;
85
87
  liveSummary?: string;
86
88
  };
@@ -88,11 +90,10 @@ type Subscription = {
88
90
  uid: string;
89
91
  dynamic: boolean;
90
92
  live: boolean;
91
- wordcloud: boolean;
92
93
  target: Target;
93
- card: SubCard;
94
- liveMsg: SubLiveMsg;
95
- liveSummary: SubLiveSummary;
94
+ customCardStyle: CustomCardStyle;
95
+ customLiveMsg: CustomLiveMsg;
96
+ customLiveSummary: CustomLiveSummary;
96
97
  };
97
98
  type Subscriptions = Record<string, Subscription>;
98
99
  //#endregion
package/lib/index.js CHANGED
@@ -81,6 +81,7 @@ const BAConfigSchema = koishi.Schema.object({
81
81
  liveAtAll: koishi.Schema.boolean().default(true).description("直播At全体"),
82
82
  liveGuardBuy: koishi.Schema.boolean().default(false).description("上舰消息"),
83
83
  wordcloud: koishi.Schema.boolean().default(true).description("弹幕词云"),
84
+ liveSummary: koishi.Schema.boolean().default(true).description("直播总结"),
84
85
  platform: koishi.Schema.string().required().description("平台名"),
85
86
  target: koishi.Schema.string().required().description("群号/频道号")
86
87
  })).role("table").description("输入订阅信息,自定义订阅内容; 群号/频道号格式:频道号,频道号 使用英文逗号分隔,例如 1234567,2345678"),
@@ -191,7 +192,7 @@ let PushType = /* @__PURE__ */ function(PushType$1) {
191
192
  PushType$1[PushType$1["DynamicAtAll"] = 2] = "DynamicAtAll";
192
193
  PushType$1[PushType$1["StartBroadcasting"] = 3] = "StartBroadcasting";
193
194
  PushType$1[PushType$1["LiveGuardBuy"] = 4] = "LiveGuardBuy";
194
- PushType$1[PushType$1["WordCloud"] = 5] = "WordCloud";
195
+ PushType$1[PushType$1["WordCloudAndLiveSummary"] = 5] = "WordCloudAndLiveSummary";
195
196
  return PushType$1;
196
197
  }({});
197
198
  const PushTypeMsg = {
@@ -200,7 +201,7 @@ const PushTypeMsg = {
200
201
  [PushType.DynamicAtAll]: "动态推送+At全体",
201
202
  [PushType.StartBroadcasting]: "开播推送",
202
203
  [PushType.LiveGuardBuy]: "上舰推送",
203
- [PushType.WordCloud]: "弹幕词云推送"
204
+ [PushType.WordCloudAndLiveSummary]: "弹幕词云和直播总结推送"
204
205
  };
205
206
 
206
207
  //#endregion
@@ -642,7 +643,8 @@ var ComRegister = class {
642
643
  const seccode = `${validate}|jordan`;
643
644
  const { data: validateCaptchaData } = await ctx["bilibili-notify-api"].validateCaptcha(data.geetest.challenge, data.token, validate, seccode);
644
645
  if (validateCaptchaData?.is_valid !== 1) return "验证不成功!";
645
- return "验证成功!请重启插件";
646
+ await ctx["bilibili-notify-api"].getUserInfo("114514", validateCaptchaData.grisk_id);
647
+ await session.send("验证成功!请重启插件");
646
648
  });
647
649
  }
648
650
  async init(config) {
@@ -666,7 +668,7 @@ var ComRegister = class {
666
668
  } else if (config.subs && config.subs.length > 0) {
667
669
  const subs = this.configSubsToSubscription(config.subs);
668
670
  await this.initAsyncPart(subs);
669
- } else this.logger.info("插件初始化完毕!");
671
+ }
670
672
  this.ctx.on("dispose", () => {
671
673
  if (this.loginTimer) this.loginTimer();
672
674
  if (this.dynamicJob) this.dynamicJob.stop();
@@ -721,6 +723,7 @@ var ComRegister = class {
721
723
  liveAtAll: s.liveAtAll,
722
724
  liveGuardBuy: s.liveGuardBuy,
723
725
  wordcloud: s.wordcloud,
726
+ liveSummary: s.liveSummary,
724
727
  bot: null
725
728
  }));
726
729
  const target = [{
@@ -731,11 +734,10 @@ var ComRegister = class {
731
734
  uid: s.uid,
732
735
  dynamic: s.dynamic,
733
736
  live: s.live,
734
- wordcloud: s.wordcloud,
735
737
  target,
736
- card: { enable: false },
737
- liveMsg: { enable: false },
738
- liveSummary: { enable: false }
738
+ customCardStyle: { enable: false },
739
+ customLiveMsg: { enable: false },
740
+ customLiveSummary: { enable: false }
739
741
  };
740
742
  });
741
743
  return subs;
@@ -791,12 +793,12 @@ var ComRegister = class {
791
793
  customLiveEnd: this.config.customLiveEnd || "",
792
794
  liveSummary: this.config.liveSummary.join("\n") || ""
793
795
  };
794
- if (sub.liveMsg.enable) {
795
- liveMsg.customLiveStart = sub.liveMsg.customLiveStart || this.config.customLiveStart;
796
- liveMsg.customLive = sub.liveMsg.customLive || this.config.customLive;
797
- liveMsg.customLiveEnd = sub.liveMsg.customLiveEnd || this.config.customLiveEnd;
796
+ if (sub.customLiveMsg.enable) {
797
+ liveMsg.customLiveStart = sub.customLiveMsg.customLiveStart || this.config.customLiveStart;
798
+ liveMsg.customLive = sub.customLiveMsg.customLive || this.config.customLive;
799
+ liveMsg.customLiveEnd = sub.customLiveMsg.customLiveEnd || this.config.customLiveEnd;
798
800
  }
799
- if (sub.liveSummary.enable) liveMsg.liveSummary = sub.liveSummary.liveSummary || this.config.liveSummary.join("\n");
801
+ if (sub.customLiveSummary.enable) liveMsg.liveSummary = sub.customLiveSummary.liveSummary || this.config.liveSummary.join("\n");
800
802
  this.liveMsgManager.set(sub.uid, liveMsg);
801
803
  const dynamicArr = [];
802
804
  const dynamicAtAllArr = [];
@@ -804,6 +806,7 @@ var ComRegister = class {
804
806
  const liveAtAllArr = [];
805
807
  const liveGuardBuyArr = [];
806
808
  const wordcloudArr = [];
809
+ const liveSummaryArr = [];
807
810
  for (const platform of sub.target) for (const channel of platform.channelArr) {
808
811
  const target = `${platform.platform}:${channel.channelId}`;
809
812
  if (channel.dynamic) dynamicArr.push(target);
@@ -812,12 +815,14 @@ var ComRegister = class {
812
815
  if (channel.liveAtAll) liveAtAllArr.push(target);
813
816
  if (channel.liveGuardBuy) liveGuardBuyArr.push(target);
814
817
  if (channel.wordcloud) wordcloudArr.push(target);
818
+ if (channel.liveSummary) liveSummaryArr.push(target);
815
819
  }
816
820
  this.pushArrMap.set(sub.uid, {
817
821
  dynamicArr,
818
822
  dynamicAtAllArr,
819
823
  liveArr,
820
824
  liveAtAllArr,
825
+ liveSummaryArr,
821
826
  liveGuardBuyArr,
822
827
  wordcloudArr
823
828
  });
@@ -879,15 +884,37 @@ var ComRegister = class {
879
884
  }, 1);
880
885
  this.logger.info(`成功推送上舰消息:${success.length}条`);
881
886
  }
882
- if (type === PushType.WordCloud && record.wordcloudArr?.length >= 1) {
883
- this.logger.info(record.wordcloudArr);
887
+ if (type === PushType.WordCloudAndLiveSummary) {
884
888
  const wordcloudArr = structuredClone(record.wordcloudArr);
885
- const success = await withRetry(async () => {
886
- return await this.ctx.broadcast(wordcloudArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content }));
887
- }, 1);
888
- this.logger.info(`成功推送词云消息:${success.length}条`);
889
+ const liveSummaryArr = structuredClone(record.liveSummaryArr);
890
+ const wordcloudAndLiveSummaryArr = wordcloudArr.filter((item) => liveSummaryArr.includes(item));
891
+ const wordcloudOnlyArr = wordcloudArr.filter((item) => !liveSummaryArr.includes(item));
892
+ const liveSummaryOnlyArr = liveSummaryArr.filter((item) => !wordcloudArr.includes(item));
893
+ if (wordcloudAndLiveSummaryArr.length > 0) {
894
+ this.logger.info("词云和直播总结");
895
+ this.logger.info(wordcloudAndLiveSummaryArr);
896
+ const success = await withRetry(async () => {
897
+ return await this.ctx.broadcast(wordcloudAndLiveSummaryArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsxs)("message", { children: [content[0], content[1]] }));
898
+ }, 1);
899
+ this.logger.info(`成功推送词云和直播总结消息:${success.length}条`);
900
+ }
901
+ if (wordcloudOnlyArr.length > 0) {
902
+ this.logger.info("词云");
903
+ this.logger.info(wordcloudOnlyArr);
904
+ const success = await withRetry(async () => {
905
+ return await this.ctx.broadcast(wordcloudOnlyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content[0] }));
906
+ }, 1);
907
+ this.logger.info(`成功推送词云消息:${success.length}条`);
908
+ }
909
+ if (liveSummaryOnlyArr.length > 0) {
910
+ this.logger.info("直播总结");
911
+ this.logger.info(liveSummaryOnlyArr);
912
+ const success = await withRetry(async () => {
913
+ return await this.ctx.broadcast(liveSummaryOnlyArr, /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: content[1] }));
914
+ }, 1);
915
+ this.logger.info(`成功推送直播总结消息:${success.length}条`);
916
+ }
889
917
  }
890
- return;
891
918
  }
892
919
  dynamicDetect() {
893
920
  const handler = async () => {
@@ -933,7 +960,7 @@ var ComRegister = class {
933
960
  if (timeline < postTime) {
934
961
  const sub = this.subManager.find((sub$1) => sub$1.uid === uid);
935
962
  const buffer = await withRetry(async () => {
936
- return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.card.enable ? sub.card : void 0);
963
+ return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.customCardStyle.enable ? sub.customCardStyle : void 0);
937
964
  }, 1).catch(async (e) => {
938
965
  if (e.message === "直播开播动态,不做处理") return;
939
966
  if (e.message === "出现关键词,屏蔽该动态") {
@@ -1038,7 +1065,7 @@ var ComRegister = class {
1038
1065
  const sub = this.subManager.find((sub$1) => sub$1.uid === uid);
1039
1066
  this.logger.info("开始渲染推送卡片...");
1040
1067
  const buffer = await withRetry(async () => {
1041
- return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.card.enable ? sub.card : void 0);
1068
+ return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.customCardStyle.enable ? sub.customCardStyle : void 0);
1042
1069
  }, 1).catch(async (e) => {
1043
1070
  if (e.message === "直播开播动态,不做处理") return;
1044
1071
  if (e.message === "出现关键词,屏蔽该动态") {
@@ -1163,7 +1190,7 @@ var ComRegister = class {
1163
1190
  let masterInfo;
1164
1191
  let watchedNum;
1165
1192
  const liveMsgObj = this.liveMsgManager.get(sub.uid);
1166
- const sendDanmakuWordCloud = async (liveSummary) => {
1193
+ const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
1167
1194
  this.logger.info("开始制作弹幕词云");
1168
1195
  this.logger.info("正在获取前90热词");
1169
1196
  const top90Words = Object.entries(danmakuWeightRecord).sort((a, b) => b[1] - a[1]).slice(0, 90);
@@ -1171,15 +1198,14 @@ var ComRegister = class {
1171
1198
  this.logger.info(top90Words);
1172
1199
  this.logger.info("正在准备生成弹幕词云");
1173
1200
  const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
1174
- this.logger.info("弹幕词云生成完成,正在准备发送词云图片");
1175
- await this.broadcastToTargets(sub.uid, koishi.h.image(buffer, "image/jpeg"), PushType.Live);
1176
- this.logger.info("词云图片发送完毕!");
1201
+ const img = /* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(buffer, "image/jpeg") });
1177
1202
  this.logger.info("开始构建弹幕发送排行榜消息");
1178
1203
  const danmakuMakerCount = Object.keys(danmakuMakerRecord).length;
1179
1204
  const danmakuCount = Object.values(danmakuMakerRecord).reduce((sum, val) => sum + val, 0);
1180
1205
  const top5DanmakuMaker = Object.entries(danmakuMakerRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
1181
- const danmakuMakerMsg = liveSummary.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");
1182
- await this.broadcastToTargets(sub.uid, danmakuMakerMsg, PushType.WordCloud);
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 });
1208
+ await this.broadcastToTargets(sub.uid, [img, summary], PushType.WordCloudAndLiveSummary);
1183
1209
  Object.keys(danmakuWeightRecord).forEach((key) => delete danmakuWeightRecord[key]);
1184
1210
  Object.keys(danmakuMakerRecord).forEach((key) => delete danmakuMakerRecord[key]);
1185
1211
  };
@@ -1200,7 +1226,7 @@ var ComRegister = class {
1200
1226
  await this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
1201
1227
  liveRoomInfo,
1202
1228
  masterInfo,
1203
- cardStyle: sub.card
1229
+ cardStyle: sub.customCardStyle
1204
1230
  }, sub.uid, liveMsg);
1205
1231
  };
1206
1232
  const useMasterAndLiveRoomInfo = async (liveType) => {
@@ -1264,7 +1290,7 @@ var ComRegister = class {
1264
1290
  await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1265
1291
  liveRoomInfo,
1266
1292
  masterInfo,
1267
- cardStyle: sub.card
1293
+ cardStyle: sub.customCardStyle
1268
1294
  }, sub.uid, liveStartMsg);
1269
1295
  if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
1270
1296
  },
@@ -1284,11 +1310,11 @@ var ComRegister = class {
1284
1310
  await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1285
1311
  liveRoomInfo,
1286
1312
  masterInfo,
1287
- cardStyle: sub.card
1313
+ cardStyle: sub.customCardStyle
1288
1314
  }, sub.uid, liveEndMsg);
1289
1315
  pushAtTimeTimer();
1290
1316
  pushAtTimeTimer = null;
1291
- if (sub.wordcloud) await sendDanmakuWordCloud(liveMsgObj.liveSummary);
1317
+ await sendDanmakuWordCloudAndLiveSummary(liveMsgObj.liveSummary);
1292
1318
  }
1293
1319
  };
1294
1320
  await this.ctx["bilibili-notify-live"].startLiveRoomListener(roomId, handler);
@@ -1300,7 +1326,7 @@ var ComRegister = class {
1300
1326
  if (this.config.restartPush) await this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
1301
1327
  liveRoomInfo,
1302
1328
  masterInfo,
1303
- cardStyle: sub.card
1329
+ cardStyle: sub.customCardStyle
1304
1330
  }, sub.uid, liveMsg);
1305
1331
  if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
1306
1332
  liveStatus = true;
@@ -1352,7 +1378,7 @@ var ComRegister = class {
1352
1378
  await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1353
1379
  liveRoomInfo: liveStatus.liveRoomInfo,
1354
1380
  masterInfo: liveStatus.masterInfo,
1355
- cardStyle: sub.card
1381
+ cardStyle: sub.customCardStyle
1356
1382
  }, sub.uid, liveMsg);
1357
1383
  }
1358
1384
  }
@@ -1385,7 +1411,7 @@ var ComRegister = class {
1385
1411
  await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1386
1412
  liveRoomInfo: liveStatus.liveRoomInfo,
1387
1413
  masterInfo: liveStatus.masterInfo,
1388
- cardStyle: sub.card
1414
+ cardStyle: sub.customCardStyle
1389
1415
  }, sub.uid, liveEndMsg);
1390
1416
  liveStatus.live = false;
1391
1417
  }
@@ -1404,7 +1430,7 @@ var ComRegister = class {
1404
1430
  await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1405
1431
  liveRoomInfo: liveStatus.liveRoomInfo,
1406
1432
  masterInfo: liveStatus.masterInfo,
1407
- cardStyle: sub.card
1433
+ cardStyle: sub.customCardStyle
1408
1434
  }, sub.uid, liveStartMsg);
1409
1435
  liveStatus.live = true;
1410
1436
  }
@@ -1425,7 +1451,7 @@ var ComRegister = class {
1425
1451
  await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1426
1452
  liveRoomInfo: liveStatus.liveRoomInfo,
1427
1453
  masterInfo: liveStatus.masterInfo,
1428
- cardStyle: sub.card
1454
+ cardStyle: sub.customCardStyle
1429
1455
  }, sub.uid, liveMsg);
1430
1456
  liveStatus.push = 0;
1431
1457
  }
@@ -1611,7 +1637,7 @@ var ComRegister = class {
1611
1637
  };
1612
1638
  });
1613
1639
  if (userInfoCode === -352 && userInfoData.v_voucher) {
1614
- this.logger.info("账号被风控,请使用指令 bili captcha 进行风控验证");
1640
+ this.logger.info("账号被风控,请使用指令 bili cap 进行风控验证");
1615
1641
  await this.sendPrivateMsg("账号被风控,请使用指令 bili cap 进行风控验证");
1616
1642
  return {
1617
1643
  code: userInfoCode,
@@ -1632,16 +1658,15 @@ var ComRegister = class {
1632
1658
  const subInfo = await this.subUserInBili(sub.uid);
1633
1659
  if (subInfo.code !== 0) return subInfo;
1634
1660
  this.subManager.push({
1635
- id: +sub.uid,
1636
1661
  uid: sub.uid,
1637
1662
  uname: userInfoData.name,
1638
1663
  roomId: sub.live ? userInfoData.live_room.roomid : "",
1639
1664
  target: sub.target,
1640
- platform: "",
1641
1665
  live: sub.live,
1642
1666
  dynamic: sub.dynamic,
1643
- card: sub.card,
1644
- liveMsg: sub.liveMsg
1667
+ customCardStyle: sub.customCardStyle,
1668
+ customLiveMsg: sub.customLiveMsg,
1669
+ customLiveSummary: sub.customLiveSummary
1645
1670
  });
1646
1671
  this.logger.info(`UID:${sub.uid}订阅加载完毕!`);
1647
1672
  if (sub !== Object.values(subs).pop()) {
@@ -1692,6 +1717,7 @@ var ComRegister = class {
1692
1717
  liveAtAll: koishi.Schema.boolean().default(true).description("直播At全体"),
1693
1718
  liveGuardBuy: koishi.Schema.boolean().default(false).description("上舰消息"),
1694
1719
  wordcloud: koishi.Schema.boolean().default(true).description("弹幕词云"),
1720
+ liveSummary: koishi.Schema.boolean().default(true).description("直播总结"),
1695
1721
  platform: koishi.Schema.string().required().description("平台名"),
1696
1722
  target: koishi.Schema.string().required().description("群号/频道号")
1697
1723
  })).role("table").description("输入订阅信息,自定义订阅内容; 群号/频道号格式:频道号,频道号 使用英文逗号分隔,例如 1234567,2345678"),
@@ -3620,13 +3646,15 @@ var BiliAPI = class extends koishi.Service {
3620
3646
  retries: 3
3621
3647
  });
3622
3648
  }
3623
- async getUserInfo(mid) {
3649
+ async getUserInfo(mid, grisk_id) {
3624
3650
  const run = async () => {
3625
3651
  if (mid === "11783021") {
3626
3652
  console.log("检测到番剧出差UID,跳过远程用户接口访问");
3627
3653
  return bangumiTripData;
3628
3654
  }
3629
- const wbi = await this.getWbi({ mid });
3655
+ const params = { mid };
3656
+ if (grisk_id) params.grisk_id = grisk_id;
3657
+ const wbi = await this.getWbi(params);
3630
3658
  const { data } = await this.client.get(`${GET_USER_INFO}?${wbi}`);
3631
3659
  return data;
3632
3660
  };
@@ -3992,6 +4020,7 @@ var BiliAPI = class extends koishi.Service {
3992
4020
  this.logger.info(`验证失败:错误码=${data.code},错误消息:${data.message}`);
3993
4021
  return { data: null };
3994
4022
  }
4023
+ this.addCookie(`x-bili-gaia-vtoken=${data.data.grisk_id}`);
3995
4024
  return { data: data.data };
3996
4025
  }
3997
4026
  };
package/lib/index.mjs CHANGED
@@ -62,6 +62,7 @@ const BAConfigSchema = Schema.object({
62
62
  liveAtAll: Schema.boolean().default(true).description("直播At全体"),
63
63
  liveGuardBuy: Schema.boolean().default(false).description("上舰消息"),
64
64
  wordcloud: Schema.boolean().default(true).description("弹幕词云"),
65
+ liveSummary: Schema.boolean().default(true).description("直播总结"),
65
66
  platform: Schema.string().required().description("平台名"),
66
67
  target: Schema.string().required().description("群号/频道号")
67
68
  })).role("table").description("输入订阅信息,自定义订阅内容; 群号/频道号格式:频道号,频道号 使用英文逗号分隔,例如 1234567,2345678"),
@@ -172,7 +173,7 @@ let PushType = /* @__PURE__ */ function(PushType$1) {
172
173
  PushType$1[PushType$1["DynamicAtAll"] = 2] = "DynamicAtAll";
173
174
  PushType$1[PushType$1["StartBroadcasting"] = 3] = "StartBroadcasting";
174
175
  PushType$1[PushType$1["LiveGuardBuy"] = 4] = "LiveGuardBuy";
175
- PushType$1[PushType$1["WordCloud"] = 5] = "WordCloud";
176
+ PushType$1[PushType$1["WordCloudAndLiveSummary"] = 5] = "WordCloudAndLiveSummary";
176
177
  return PushType$1;
177
178
  }({});
178
179
  const PushTypeMsg = {
@@ -181,7 +182,7 @@ const PushTypeMsg = {
181
182
  [PushType.DynamicAtAll]: "动态推送+At全体",
182
183
  [PushType.StartBroadcasting]: "开播推送",
183
184
  [PushType.LiveGuardBuy]: "上舰推送",
184
- [PushType.WordCloud]: "弹幕词云推送"
185
+ [PushType.WordCloudAndLiveSummary]: "弹幕词云和直播总结推送"
185
186
  };
186
187
 
187
188
  //#endregion
@@ -623,7 +624,8 @@ var ComRegister = class {
623
624
  const seccode = `${validate}|jordan`;
624
625
  const { data: validateCaptchaData } = await ctx["bilibili-notify-api"].validateCaptcha(data.geetest.challenge, data.token, validate, seccode);
625
626
  if (validateCaptchaData?.is_valid !== 1) return "验证不成功!";
626
- return "验证成功!请重启插件";
627
+ await ctx["bilibili-notify-api"].getUserInfo("114514", validateCaptchaData.grisk_id);
628
+ await session.send("验证成功!请重启插件");
627
629
  });
628
630
  }
629
631
  async init(config) {
@@ -647,7 +649,7 @@ var ComRegister = class {
647
649
  } else if (config.subs && config.subs.length > 0) {
648
650
  const subs = this.configSubsToSubscription(config.subs);
649
651
  await this.initAsyncPart(subs);
650
- } else this.logger.info("插件初始化完毕!");
652
+ }
651
653
  this.ctx.on("dispose", () => {
652
654
  if (this.loginTimer) this.loginTimer();
653
655
  if (this.dynamicJob) this.dynamicJob.stop();
@@ -702,6 +704,7 @@ var ComRegister = class {
702
704
  liveAtAll: s.liveAtAll,
703
705
  liveGuardBuy: s.liveGuardBuy,
704
706
  wordcloud: s.wordcloud,
707
+ liveSummary: s.liveSummary,
705
708
  bot: null
706
709
  }));
707
710
  const target = [{
@@ -712,11 +715,10 @@ var ComRegister = class {
712
715
  uid: s.uid,
713
716
  dynamic: s.dynamic,
714
717
  live: s.live,
715
- wordcloud: s.wordcloud,
716
718
  target,
717
- card: { enable: false },
718
- liveMsg: { enable: false },
719
- liveSummary: { enable: false }
719
+ customCardStyle: { enable: false },
720
+ customLiveMsg: { enable: false },
721
+ customLiveSummary: { enable: false }
720
722
  };
721
723
  });
722
724
  return subs;
@@ -772,12 +774,12 @@ var ComRegister = class {
772
774
  customLiveEnd: this.config.customLiveEnd || "",
773
775
  liveSummary: this.config.liveSummary.join("\n") || ""
774
776
  };
775
- if (sub.liveMsg.enable) {
776
- liveMsg.customLiveStart = sub.liveMsg.customLiveStart || this.config.customLiveStart;
777
- liveMsg.customLive = sub.liveMsg.customLive || this.config.customLive;
778
- liveMsg.customLiveEnd = sub.liveMsg.customLiveEnd || this.config.customLiveEnd;
777
+ if (sub.customLiveMsg.enable) {
778
+ liveMsg.customLiveStart = sub.customLiveMsg.customLiveStart || this.config.customLiveStart;
779
+ liveMsg.customLive = sub.customLiveMsg.customLive || this.config.customLive;
780
+ liveMsg.customLiveEnd = sub.customLiveMsg.customLiveEnd || this.config.customLiveEnd;
779
781
  }
780
- if (sub.liveSummary.enable) liveMsg.liveSummary = sub.liveSummary.liveSummary || this.config.liveSummary.join("\n");
782
+ if (sub.customLiveSummary.enable) liveMsg.liveSummary = sub.customLiveSummary.liveSummary || this.config.liveSummary.join("\n");
781
783
  this.liveMsgManager.set(sub.uid, liveMsg);
782
784
  const dynamicArr = [];
783
785
  const dynamicAtAllArr = [];
@@ -785,6 +787,7 @@ var ComRegister = class {
785
787
  const liveAtAllArr = [];
786
788
  const liveGuardBuyArr = [];
787
789
  const wordcloudArr = [];
790
+ const liveSummaryArr = [];
788
791
  for (const platform of sub.target) for (const channel of platform.channelArr) {
789
792
  const target = `${platform.platform}:${channel.channelId}`;
790
793
  if (channel.dynamic) dynamicArr.push(target);
@@ -793,12 +796,14 @@ var ComRegister = class {
793
796
  if (channel.liveAtAll) liveAtAllArr.push(target);
794
797
  if (channel.liveGuardBuy) liveGuardBuyArr.push(target);
795
798
  if (channel.wordcloud) wordcloudArr.push(target);
799
+ if (channel.liveSummary) liveSummaryArr.push(target);
796
800
  }
797
801
  this.pushArrMap.set(sub.uid, {
798
802
  dynamicArr,
799
803
  dynamicAtAllArr,
800
804
  liveArr,
801
805
  liveAtAllArr,
806
+ liveSummaryArr,
802
807
  liveGuardBuyArr,
803
808
  wordcloudArr
804
809
  });
@@ -860,15 +865,37 @@ var ComRegister = class {
860
865
  }, 1);
861
866
  this.logger.info(`成功推送上舰消息:${success.length}条`);
862
867
  }
863
- if (type === PushType.WordCloud && record.wordcloudArr?.length >= 1) {
864
- this.logger.info(record.wordcloudArr);
868
+ if (type === PushType.WordCloudAndLiveSummary) {
865
869
  const wordcloudArr = structuredClone(record.wordcloudArr);
866
- const success = await withRetry(async () => {
867
- return await this.ctx.broadcast(wordcloudArr, /* @__PURE__ */ jsx("message", { children: content }));
868
- }, 1);
869
- this.logger.info(`成功推送词云消息:${success.length}条`);
870
+ const liveSummaryArr = structuredClone(record.liveSummaryArr);
871
+ const wordcloudAndLiveSummaryArr = wordcloudArr.filter((item) => liveSummaryArr.includes(item));
872
+ const wordcloudOnlyArr = wordcloudArr.filter((item) => !liveSummaryArr.includes(item));
873
+ const liveSummaryOnlyArr = liveSummaryArr.filter((item) => !wordcloudArr.includes(item));
874
+ if (wordcloudAndLiveSummaryArr.length > 0) {
875
+ this.logger.info("词云和直播总结");
876
+ this.logger.info(wordcloudAndLiveSummaryArr);
877
+ const success = await withRetry(async () => {
878
+ return await this.ctx.broadcast(wordcloudAndLiveSummaryArr, /* @__PURE__ */ jsxs("message", { children: [content[0], content[1]] }));
879
+ }, 1);
880
+ this.logger.info(`成功推送词云和直播总结消息:${success.length}条`);
881
+ }
882
+ if (wordcloudOnlyArr.length > 0) {
883
+ this.logger.info("词云");
884
+ this.logger.info(wordcloudOnlyArr);
885
+ const success = await withRetry(async () => {
886
+ return await this.ctx.broadcast(wordcloudOnlyArr, /* @__PURE__ */ jsx("message", { children: content[0] }));
887
+ }, 1);
888
+ this.logger.info(`成功推送词云消息:${success.length}条`);
889
+ }
890
+ if (liveSummaryOnlyArr.length > 0) {
891
+ this.logger.info("直播总结");
892
+ this.logger.info(liveSummaryOnlyArr);
893
+ const success = await withRetry(async () => {
894
+ return await this.ctx.broadcast(liveSummaryOnlyArr, /* @__PURE__ */ jsx("message", { children: content[1] }));
895
+ }, 1);
896
+ this.logger.info(`成功推送直播总结消息:${success.length}条`);
897
+ }
870
898
  }
871
- return;
872
899
  }
873
900
  dynamicDetect() {
874
901
  const handler = async () => {
@@ -914,7 +941,7 @@ var ComRegister = class {
914
941
  if (timeline < postTime) {
915
942
  const sub = this.subManager.find((sub$1) => sub$1.uid === uid);
916
943
  const buffer = await withRetry(async () => {
917
- return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.card.enable ? sub.card : void 0);
944
+ return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.customCardStyle.enable ? sub.customCardStyle : void 0);
918
945
  }, 1).catch(async (e) => {
919
946
  if (e.message === "直播开播动态,不做处理") return;
920
947
  if (e.message === "出现关键词,屏蔽该动态") {
@@ -1019,7 +1046,7 @@ var ComRegister = class {
1019
1046
  const sub = this.subManager.find((sub$1) => sub$1.uid === uid);
1020
1047
  this.logger.info("开始渲染推送卡片...");
1021
1048
  const buffer = await withRetry(async () => {
1022
- return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.card.enable ? sub.card : void 0);
1049
+ return await this.ctx["bilibili-notify-generate-img"].generateDynamicImg(item, sub.customCardStyle.enable ? sub.customCardStyle : void 0);
1023
1050
  }, 1).catch(async (e) => {
1024
1051
  if (e.message === "直播开播动态,不做处理") return;
1025
1052
  if (e.message === "出现关键词,屏蔽该动态") {
@@ -1144,7 +1171,7 @@ var ComRegister = class {
1144
1171
  let masterInfo;
1145
1172
  let watchedNum;
1146
1173
  const liveMsgObj = this.liveMsgManager.get(sub.uid);
1147
- const sendDanmakuWordCloud = async (liveSummary) => {
1174
+ const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
1148
1175
  this.logger.info("开始制作弹幕词云");
1149
1176
  this.logger.info("正在获取前90热词");
1150
1177
  const top90Words = Object.entries(danmakuWeightRecord).sort((a, b) => b[1] - a[1]).slice(0, 90);
@@ -1152,15 +1179,14 @@ var ComRegister = class {
1152
1179
  this.logger.info(top90Words);
1153
1180
  this.logger.info("正在准备生成弹幕词云");
1154
1181
  const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
1155
- this.logger.info("弹幕词云生成完成,正在准备发送词云图片");
1156
- await this.broadcastToTargets(sub.uid, h.image(buffer, "image/jpeg"), PushType.Live);
1157
- this.logger.info("词云图片发送完毕!");
1182
+ const img = /* @__PURE__ */ jsx("message", { children: h.image(buffer, "image/jpeg") });
1158
1183
  this.logger.info("开始构建弹幕发送排行榜消息");
1159
1184
  const danmakuMakerCount = Object.keys(danmakuMakerRecord).length;
1160
1185
  const danmakuCount = Object.values(danmakuMakerRecord).reduce((sum, val) => sum + val, 0);
1161
1186
  const top5DanmakuMaker = Object.entries(danmakuMakerRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
1162
- const danmakuMakerMsg = liveSummary.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");
1163
- await this.broadcastToTargets(sub.uid, danmakuMakerMsg, PushType.WordCloud);
1187
+ 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");
1188
+ const summary = /* @__PURE__ */ jsx("message", { children: danmakuMakerMsg });
1189
+ await this.broadcastToTargets(sub.uid, [img, summary], PushType.WordCloudAndLiveSummary);
1164
1190
  Object.keys(danmakuWeightRecord).forEach((key) => delete danmakuWeightRecord[key]);
1165
1191
  Object.keys(danmakuMakerRecord).forEach((key) => delete danmakuMakerRecord[key]);
1166
1192
  };
@@ -1181,7 +1207,7 @@ var ComRegister = class {
1181
1207
  await this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
1182
1208
  liveRoomInfo,
1183
1209
  masterInfo,
1184
- cardStyle: sub.card
1210
+ cardStyle: sub.customCardStyle
1185
1211
  }, sub.uid, liveMsg);
1186
1212
  };
1187
1213
  const useMasterAndLiveRoomInfo = async (liveType) => {
@@ -1245,7 +1271,7 @@ var ComRegister = class {
1245
1271
  await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1246
1272
  liveRoomInfo,
1247
1273
  masterInfo,
1248
- cardStyle: sub.card
1274
+ cardStyle: sub.customCardStyle
1249
1275
  }, sub.uid, liveStartMsg);
1250
1276
  if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
1251
1277
  },
@@ -1265,11 +1291,11 @@ var ComRegister = class {
1265
1291
  await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1266
1292
  liveRoomInfo,
1267
1293
  masterInfo,
1268
- cardStyle: sub.card
1294
+ cardStyle: sub.customCardStyle
1269
1295
  }, sub.uid, liveEndMsg);
1270
1296
  pushAtTimeTimer();
1271
1297
  pushAtTimeTimer = null;
1272
- if (sub.wordcloud) await sendDanmakuWordCloud(liveMsgObj.liveSummary);
1298
+ await sendDanmakuWordCloudAndLiveSummary(liveMsgObj.liveSummary);
1273
1299
  }
1274
1300
  };
1275
1301
  await this.ctx["bilibili-notify-live"].startLiveRoomListener(roomId, handler);
@@ -1281,7 +1307,7 @@ var ComRegister = class {
1281
1307
  if (this.config.restartPush) await this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
1282
1308
  liveRoomInfo,
1283
1309
  masterInfo,
1284
- cardStyle: sub.card
1310
+ cardStyle: sub.customCardStyle
1285
1311
  }, sub.uid, liveMsg);
1286
1312
  if (this.config.pushTime !== 0 && !pushAtTimeTimer) pushAtTimeTimer = this.ctx.setInterval(pushAtTimeFunc, this.config.pushTime * 1e3 * 60 * 60);
1287
1313
  liveStatus = true;
@@ -1333,7 +1359,7 @@ var ComRegister = class {
1333
1359
  await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1334
1360
  liveRoomInfo: liveStatus.liveRoomInfo,
1335
1361
  masterInfo: liveStatus.masterInfo,
1336
- cardStyle: sub.card
1362
+ cardStyle: sub.customCardStyle
1337
1363
  }, sub.uid, liveMsg);
1338
1364
  }
1339
1365
  }
@@ -1366,7 +1392,7 @@ var ComRegister = class {
1366
1392
  await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1367
1393
  liveRoomInfo: liveStatus.liveRoomInfo,
1368
1394
  masterInfo: liveStatus.masterInfo,
1369
- cardStyle: sub.card
1395
+ cardStyle: sub.customCardStyle
1370
1396
  }, sub.uid, liveEndMsg);
1371
1397
  liveStatus.live = false;
1372
1398
  }
@@ -1385,7 +1411,7 @@ var ComRegister = class {
1385
1411
  await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1386
1412
  liveRoomInfo: liveStatus.liveRoomInfo,
1387
1413
  masterInfo: liveStatus.masterInfo,
1388
- cardStyle: sub.card
1414
+ cardStyle: sub.customCardStyle
1389
1415
  }, sub.uid, liveStartMsg);
1390
1416
  liveStatus.live = true;
1391
1417
  }
@@ -1406,7 +1432,7 @@ var ComRegister = class {
1406
1432
  await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1407
1433
  liveRoomInfo: liveStatus.liveRoomInfo,
1408
1434
  masterInfo: liveStatus.masterInfo,
1409
- cardStyle: sub.card
1435
+ cardStyle: sub.customCardStyle
1410
1436
  }, sub.uid, liveMsg);
1411
1437
  liveStatus.push = 0;
1412
1438
  }
@@ -1592,7 +1618,7 @@ var ComRegister = class {
1592
1618
  };
1593
1619
  });
1594
1620
  if (userInfoCode === -352 && userInfoData.v_voucher) {
1595
- this.logger.info("账号被风控,请使用指令 bili captcha 进行风控验证");
1621
+ this.logger.info("账号被风控,请使用指令 bili cap 进行风控验证");
1596
1622
  await this.sendPrivateMsg("账号被风控,请使用指令 bili cap 进行风控验证");
1597
1623
  return {
1598
1624
  code: userInfoCode,
@@ -1613,16 +1639,15 @@ var ComRegister = class {
1613
1639
  const subInfo = await this.subUserInBili(sub.uid);
1614
1640
  if (subInfo.code !== 0) return subInfo;
1615
1641
  this.subManager.push({
1616
- id: +sub.uid,
1617
1642
  uid: sub.uid,
1618
1643
  uname: userInfoData.name,
1619
1644
  roomId: sub.live ? userInfoData.live_room.roomid : "",
1620
1645
  target: sub.target,
1621
- platform: "",
1622
1646
  live: sub.live,
1623
1647
  dynamic: sub.dynamic,
1624
- card: sub.card,
1625
- liveMsg: sub.liveMsg
1648
+ customCardStyle: sub.customCardStyle,
1649
+ customLiveMsg: sub.customLiveMsg,
1650
+ customLiveSummary: sub.customLiveSummary
1626
1651
  });
1627
1652
  this.logger.info(`UID:${sub.uid}订阅加载完毕!`);
1628
1653
  if (sub !== Object.values(subs).pop()) {
@@ -1673,6 +1698,7 @@ var ComRegister = class {
1673
1698
  liveAtAll: Schema.boolean().default(true).description("直播At全体"),
1674
1699
  liveGuardBuy: Schema.boolean().default(false).description("上舰消息"),
1675
1700
  wordcloud: Schema.boolean().default(true).description("弹幕词云"),
1701
+ liveSummary: Schema.boolean().default(true).description("直播总结"),
1676
1702
  platform: Schema.string().required().description("平台名"),
1677
1703
  target: Schema.string().required().description("群号/频道号")
1678
1704
  })).role("table").description("输入订阅信息,自定义订阅内容; 群号/频道号格式:频道号,频道号 使用英文逗号分隔,例如 1234567,2345678"),
@@ -3601,13 +3627,15 @@ var BiliAPI = class extends Service {
3601
3627
  retries: 3
3602
3628
  });
3603
3629
  }
3604
- async getUserInfo(mid) {
3630
+ async getUserInfo(mid, grisk_id) {
3605
3631
  const run = async () => {
3606
3632
  if (mid === "11783021") {
3607
3633
  console.log("检测到番剧出差UID,跳过远程用户接口访问");
3608
3634
  return bangumiTripData;
3609
3635
  }
3610
- const wbi = await this.getWbi({ mid });
3636
+ const params = { mid };
3637
+ if (grisk_id) params.grisk_id = grisk_id;
3638
+ const wbi = await this.getWbi(params);
3611
3639
  const { data } = await this.client.get(`${GET_USER_INFO}?${wbi}`);
3612
3640
  return data;
3613
3641
  };
@@ -3973,6 +4001,7 @@ var BiliAPI = class extends Service {
3973
4001
  this.logger.info(`验证失败:错误码=${data.code},错误消息:${data.message}`);
3974
4002
  return { data: null };
3975
4003
  }
4004
+ this.addCookie(`x-bili-gaia-vtoken=${data.data.grisk_id}`);
3976
4005
  return { data: data.data };
3977
4006
  }
3978
4007
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "3.3.1-alpha.0",
4
+ "version": "3.3.1-alpha.1",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -324,8 +324,9 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
324
324
  > - ver 3.2.11-alpha.12 测试版本
325
325
 
326
326
  > [!NOTE]
327
- > - ver 3.3.0-rc.0 优化:将当前版本的订阅配置移到了新插件:`bilibili-notify-advanced-subscription` ,简化当前版本订阅配置; 新增:配置项 `advancedSub` ,开启后可通过下载插件 `bilibili-notify-advanced-subscription` 配置更自定义化的订阅配置、新增动态@全体成员功能
328
- > - ver 3.3.1-alpha.0 新增:弹幕词云自定义停用词、UP主弹幕词云开关; 优化:`liveSummary` 排版方式更加直观
327
+ > - ver 3.3.0-rc.0 优化:将当前版本的订阅配置移到了新插件:`bilibili-notify-advanced-subscription` ,简化当前版本订阅配置; 新增:配置项 `advancedSub` ,开启后可通过下载插件 `bilibili-notify-advanced-subscription` 配置更自定义化的订阅配置、新增动态@全体成员功能;
328
+ > - ver 3.3.1-alpha.0 新增:弹幕词云自定义停用词、UP主弹幕词云开关; 优化:`liveSummary` 排版方式更加直观;
329
+ > - ver 3.3.1-alpha.1 优化:拆分 `wordcloud` 和 `liveSummary`,优化指令 `bili cap` 风控验证;
329
330
 
330
331
  ## 交流群
331
332