koishi-plugin-bilibili-notify 3.3.11-alpha.0 → 3.3.11-alpha.2

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.
Files changed (3) hide show
  1. package/lib/index.js +65 -49
  2. package/lib/index.mjs +65 -49
  3. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -175,6 +175,11 @@ async function withRetry(fn, maxAttempts = 3, delayMs = 1e3) {
175
175
  await new Promise((resolve$1) => setTimeout(resolve$1, delayMs * attempt));
176
176
  }
177
177
  }
178
+ function replaceButKeep(oldObj, newObj, keepKeys) {
179
+ const result = { ...newObj };
180
+ for (const key of keepKeys) result[key] = oldObj[key];
181
+ return result;
182
+ }
178
183
 
179
184
  //#endregion
180
185
  //#region src/type/index.ts
@@ -340,10 +345,11 @@ const stopwords = new Set([
340
345
  "之前",
341
346
  "某天"
342
347
  ]);
348
+ var stop_words_default = stopwords;
343
349
 
344
350
  //#endregion
345
351
  //#region src/command_register.ts
346
- var ComRegister$1 = class {
352
+ var ComRegister = class {
347
353
  static inject = [
348
354
  "bilibili-notify",
349
355
  "bilibili-notify-api",
@@ -693,10 +699,16 @@ var ComRegister$1 = class {
693
699
  return;
694
700
  }
695
701
  if (this.reciveSubTimes >= 1) await this.ctx["bilibili-notify"].restartPlugin();
696
- else await this.initAsyncPart(subs);
702
+ else {
703
+ this.processUname(subs);
704
+ await this.initAsyncPart(subs);
705
+ }
697
706
  this.reciveSubTimes++;
698
707
  });
699
708
  }
709
+ processUname(subs) {
710
+ for (const uname of Object.keys(subs)) subs[uname].uname = uname;
711
+ }
700
712
  async initAsyncPart(subs) {
701
713
  this.logger.info("获取到订阅信息,开始加载订阅...");
702
714
  const groupInfoResult = await this.getGroupInfo();
@@ -720,11 +732,11 @@ var ComRegister$1 = class {
720
732
  }
721
733
  mergeStopWords(stopWordsStr) {
722
734
  if (!stopWordsStr || stopWordsStr.trim() === "") {
723
- this.stopwords = new Set(stopwords);
735
+ this.stopwords = new Set(stop_words_default);
724
736
  return;
725
737
  }
726
738
  const additionalStopWords = stopWordsStr.split(",").map((word) => word.trim()).filter((word) => word !== "");
727
- this.stopwords = new Set([...stopwords, ...additionalStopWords]);
739
+ this.stopwords = new Set([...stop_words_default, ...additionalStopWords]);
728
740
  }
729
741
  initManagerAfterLoadSub() {
730
742
  for (const [uid, sub] of this.subManager) {
@@ -1199,9 +1211,9 @@ var ComRegister$1 = class {
1199
1211
  }
1200
1212
  return data;
1201
1213
  }
1202
- async sendLiveNotifyCard(liveType, followerDisplay, liveInfo, uid, liveNotifyMsg) {
1214
+ async sendLiveNotifyCard(liveType, liveData, liveInfo, uid, liveNotifyMsg) {
1203
1215
  const buffer = await withRetry(async () => {
1204
- return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface, followerDisplay, liveType, liveInfo.cardStyle.enable ? liveInfo.cardStyle : void 0);
1216
+ return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface, liveData, liveType, liveInfo.cardStyle.enable ? liveInfo.cardStyle : void 0);
1205
1217
  }, 1).catch((e) => {
1206
1218
  this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e.message}`);
1207
1219
  });
@@ -1223,9 +1235,12 @@ var ComRegister$1 = class {
1223
1235
  const danmakuWeightRecord = {};
1224
1236
  const danmakuMakerRecord = {};
1225
1237
  let liveStatus = false;
1226
- const liveRoomInfo = {};
1238
+ let liveRoomInfo;
1227
1239
  let masterInfo;
1228
- let watchedNum;
1240
+ const liveData = {
1241
+ watchedNum: "0",
1242
+ likedNum: "0"
1243
+ };
1229
1244
  const liveMsgObj = this.liveMsgManager.get(sub.uid);
1230
1245
  const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
1231
1246
  this.logger.info("开始制作弹幕词云");
@@ -1267,9 +1282,9 @@ var ComRegister$1 = class {
1267
1282
  return;
1268
1283
  }
1269
1284
  liveTime = liveRoomInfo.live_time;
1270
- const watched = watchedNum || "暂未获取到";
1285
+ const watched = liveData.watchedNum || "暂未获取到";
1271
1286
  const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
1272
- await this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
1287
+ await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: watched }, {
1273
1288
  liveRoomInfo,
1274
1289
  masterInfo,
1275
1290
  cardStyle: sub.customCardStyle
@@ -1285,24 +1300,18 @@ var ComRegister$1 = class {
1285
1300
  };
1286
1301
  const useLiveRoomInfo = async (liveType) => {
1287
1302
  let flag = true;
1288
- const liveRoomInfoData = await this.getLiveRoomInfo(sub.roomid).catch(() => {
1303
+ const data = await this.getLiveRoomInfo(sub.roomid).catch(() => {
1289
1304
  flag = false;
1290
- return null;
1291
1305
  });
1292
- if (!flag || !liveRoomInfoData || !liveRoomInfoData.uid) {
1306
+ if (!flag || !data || !data.uid) {
1293
1307
  flag = false;
1294
1308
  return flag;
1295
1309
  }
1296
1310
  if (liveType === LiveType.StartBroadcasting || liveType === LiveType.FirstLiveBroadcast) {
1297
- liveRoomInfo.uid = liveRoomInfoData.uid;
1298
- liveRoomInfo.live_time = liveRoomInfoData.live_time;
1299
- liveRoomInfo.short_id = liveRoomInfoData.short_id;
1300
- liveRoomInfo.room_id = liveRoomInfoData.room_id;
1301
- liveRoomInfo.online_max = 0;
1311
+ liveRoomInfo = data;
1312
+ return;
1302
1313
  }
1303
- liveRoomInfo.live_status = liveRoomInfoData.live_status;
1304
- liveRoomInfo.online = liveRoomInfoData.online;
1305
- if (liveRoomInfo.online > liveRoomInfo.online_max) liveRoomInfo.online_max = liveRoomInfo.online;
1314
+ liveRoomInfo = replaceButKeep(liveRoomInfo, data, ["live_time"]);
1306
1315
  };
1307
1316
  const LIVE_EVENT_COOLDOWN = 10 * 1e3;
1308
1317
  let lastLiveStart = 0;
@@ -1327,7 +1336,10 @@ var ComRegister$1 = class {
1327
1336
  this.broadcastToTargets(sub.uid, content, PushType.Superchat);
1328
1337
  },
1329
1338
  onWatchedChange: ({ body }) => {
1330
- watchedNum = body.text_small;
1339
+ liveData.watchedNum = body.text_small;
1340
+ },
1341
+ onLikedChange: ({ body }) => {
1342
+ liveData.likedNum = body.count.toString();
1331
1343
  },
1332
1344
  onGuardBuy: ({ body }) => {
1333
1345
  const content = (0, koishi.h)("message", [koishi.h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`)]);
@@ -1353,9 +1365,9 @@ var ComRegister$1 = class {
1353
1365
  this.logger.info(`开播粉丝数:${masterInfo.liveOpenFollowerNum}`);
1354
1366
  liveTime = liveRoomInfo?.live_time || luxon.DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
1355
1367
  const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
1356
- const follower = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
1357
- const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower", follower).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
1358
- await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1368
+ const followerNum = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
1369
+ const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower", followerNum).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
1370
+ await this.sendLiveNotifyCard(LiveType.StartBroadcasting, { fansNum: followerNum }, {
1359
1371
  liveRoomInfo,
1360
1372
  masterInfo,
1361
1373
  cardStyle: sub.customCardStyle
@@ -1391,7 +1403,7 @@ var ComRegister$1 = class {
1391
1403
  return liveFollowerChangeNum <= -1e4 ? `${(liveFollowerChangeNum / 1e4).toFixed(1)}万` : liveFollowerChangeNum.toString();
1392
1404
  })();
1393
1405
  const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
1394
- await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1406
+ await this.sendLiveNotifyCard(LiveType.StopBroadcast, { fansChanged: followerChange }, {
1395
1407
  liveRoomInfo,
1396
1408
  masterInfo,
1397
1409
  cardStyle: sub.customCardStyle
@@ -1409,9 +1421,9 @@ var ComRegister$1 = class {
1409
1421
  this.logger.info(`当前粉丝数:${masterInfo.liveOpenFollowerNum}`);
1410
1422
  if (liveRoomInfo.live_status === 1) {
1411
1423
  liveTime = liveRoomInfo.live_time;
1412
- const watched = watchedNum || "暂未获取到";
1424
+ const watched = liveData.watchedNum || "暂未获取到";
1413
1425
  const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
1414
- if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
1426
+ if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: watched }, {
1415
1427
  liveRoomInfo,
1416
1428
  masterInfo,
1417
1429
  cardStyle: sub.customCardStyle
@@ -1466,7 +1478,7 @@ var ComRegister$1 = class {
1466
1478
  LiveAPIStatus.liveStartTimeInit = true;
1467
1479
  }
1468
1480
  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}`);
1469
- await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1481
+ await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: "API" }, {
1470
1482
  liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1471
1483
  masterInfo: LiveAPIStatus.masterInfo,
1472
1484
  cardStyle: sub.customCardStyle
@@ -1499,7 +1511,7 @@ var ComRegister$1 = class {
1499
1511
  return liveFollowerChangeNum <= -1e4 ? `${liveFollowerChangeNum.toFixed(1)}万` : liveFollowerChangeNum.toString();
1500
1512
  })();
1501
1513
  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");
1502
- await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1514
+ await this.sendLiveNotifyCard(LiveType.StopBroadcast, { fansChanged: followerChange }, {
1503
1515
  liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1504
1516
  masterInfo: LiveAPIStatus.masterInfo,
1505
1517
  cardStyle: sub.customCardStyle
@@ -1515,9 +1527,9 @@ var ComRegister$1 = class {
1515
1527
  }
1516
1528
  LiveAPIStatus.liveStartTime = LiveAPIStatus.liveRoomInfo.live_time;
1517
1529
  LiveAPIStatus.liveStartTimeInit = true;
1518
- const follower = LiveAPIStatus.masterInfo.liveOpenFollowerNum >= 1e4 ? `${(LiveAPIStatus.masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : LiveAPIStatus.masterInfo.liveOpenFollowerNum.toString();
1519
- 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}`);
1520
- await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1530
+ const followerNum = LiveAPIStatus.masterInfo.liveOpenFollowerNum >= 1e4 ? `${(LiveAPIStatus.masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : LiveAPIStatus.masterInfo.liveOpenFollowerNum.toString();
1531
+ const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower", followerNum).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
1532
+ await this.sendLiveNotifyCard(LiveType.StartBroadcasting, { fansNum: followerNum }, {
1521
1533
  liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1522
1534
  masterInfo: LiveAPIStatus.masterInfo,
1523
1535
  cardStyle: sub.customCardStyle
@@ -1538,7 +1550,7 @@ var ComRegister$1 = class {
1538
1550
  LiveAPIStatus.liveStartTimeInit = true;
1539
1551
  }
1540
1552
  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}`);
1541
- await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1553
+ await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: "API" }, {
1542
1554
  liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1543
1555
  masterInfo: LiveAPIStatus.masterInfo,
1544
1556
  cardStyle: sub.customCardStyle
@@ -1855,8 +1867,8 @@ var ComRegister$1 = class {
1855
1867
  }),
1856
1868
  dynamicDebugMode: koishi.Schema.boolean().required()
1857
1869
  });
1858
- })(ComRegister$1 || (ComRegister$1 = {}));
1859
- var ComRegister = ComRegister$1;
1870
+ })(ComRegister || (ComRegister = {}));
1871
+ var command_register_default = ComRegister;
1860
1872
 
1861
1873
  //#endregion
1862
1874
  //#region src/database.ts
@@ -1892,13 +1904,16 @@ const DYNAMIC_TYPE_COURSES_SEASON = "DYNAMIC_TYPE_COURSES_SEASON";
1892
1904
  const DYNAMIC_TYPE_LIVE_RCMD = "DYNAMIC_TYPE_LIVE_RCMD";
1893
1905
  const DYNAMIC_TYPE_UGC_SEASON = "DYNAMIC_TYPE_UGC_SEASON";
1894
1906
  const ADDITIONAL_TYPE_RESERVE = "ADDITIONAL_TYPE_RESERVE";
1895
- var GenerateImg$1 = class extends koishi.Service {
1907
+ var GenerateImg = class extends koishi.Service {
1896
1908
  static inject = ["puppeteer"];
1897
1909
  giConfig;
1898
1910
  constructor(ctx, config) {
1899
1911
  super(ctx, "bilibili-notify-generate-img");
1900
1912
  this.giConfig = config;
1901
1913
  }
1914
+ numberToStr(num) {
1915
+ return num > 1e4 ? `${(num / 1e4).toFixed(1)}万` : num.toString();
1916
+ }
1902
1917
  async imgHandler(html) {
1903
1918
  const htmlPath = `file://${__dirname.replaceAll("\\", "/")}/page/0.html`;
1904
1919
  const page = await this.ctx.puppeteer.page();
@@ -1919,7 +1934,7 @@ var GenerateImg$1 = class extends koishi.Service {
1919
1934
  await page.close();
1920
1935
  return buffer;
1921
1936
  }
1922
- async generateLiveImg(data, username, userface, followerDisplay, liveStatus, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
1937
+ async generateLiveImg(data, username, userface, liveData, liveStatus, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
1923
1938
  const [titleStatus, liveTime, cover] = await this.getLiveStatus(data.live_time, liveStatus);
1924
1939
  const fontURL = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "font/HYZhengYuan-75W.ttf"));
1925
1940
  const html = `
@@ -2049,14 +2064,14 @@ var GenerateImg$1 = class extends koishi.Service {
2049
2064
  </div>
2050
2065
  ${this.giConfig.hideDesc ? "" : `<p class="card-text">${data.description ? data.description : "这个主播很懒,什么简介都没写"}</p>`}
2051
2066
  <p class="card-link">
2052
- <span>${liveStatus === 3 ? "本场直播最高人气:" : "人气:"}${data.online > 1e4 ? `${(data.online / 1e4).toFixed(1)}万` : data.online}</span>
2067
+ <span>${liveStatus === 3 ? `本场直播最高人气:${this.numberToStr(data.online_max)}` : `人气:${this.numberToStr(data.online)}`}</span>
2053
2068
  <span>分区名称:${data.area_name}</span>
2054
2069
  </p>
2055
2070
  <p class="card-link">
2056
2071
  <span>${liveTime}</span>
2057
2072
  ${this.giConfig.followerDisplay ? `
2058
2073
  <span>
2059
- ${liveStatus === 1 ? `当前粉丝数:${followerDisplay}` : liveStatus === 2 ? `${followerDisplay !== "API" ? `累计观看人数:${followerDisplay}` : ""}` : liveStatus === 3 ? `粉丝数变化:${followerDisplay}` : ""}
2074
+ ${liveStatus === 1 ? `当前粉丝数:${liveData.fansNum || "暂未获取到"}` : liveStatus === 2 ? `${liveData.watchedNum !== "API" ? `累计观看人数:${liveData.watchedNum}` : ""}` : liveStatus === 3 ? `粉丝数变化:${liveData.fansChanged}` : ""}
2060
2075
  </span>` : ""}
2061
2076
  </p>
2062
2077
  </div>
@@ -3356,8 +3371,8 @@ var GenerateImg$1 = class extends koishi.Service {
3356
3371
  hideDesc: koishi.Schema.boolean(),
3357
3372
  followerDisplay: koishi.Schema.boolean()
3358
3373
  });
3359
- })(GenerateImg$1 || (GenerateImg$1 = {}));
3360
- var GenerateImg = GenerateImg$1;
3374
+ })(GenerateImg || (GenerateImg = {}));
3375
+ var generate_img_default = GenerateImg;
3361
3376
 
3362
3377
  //#endregion
3363
3378
  //#region src/bili_api.ts
@@ -3452,7 +3467,7 @@ const COPY_USER_TO_GROUP = "https://api.bilibili.com/x/relation/tags/copyUsers";
3452
3467
  const GET_RELATION_GROUP_DETAIL = "https://api.bilibili.com/x/relation/tag";
3453
3468
  const GET_LIVE_ROOM_INFO_STREAM_KEY = "https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo";
3454
3469
  const GET_LIVE_ROOMS_INFO = "https://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids";
3455
- var BiliAPI$1 = class extends koishi.Service {
3470
+ var BiliAPI = class extends koishi.Service {
3456
3471
  static inject = ["database", "notifier"];
3457
3472
  jar;
3458
3473
  client;
@@ -4134,8 +4149,8 @@ var BiliAPI$1 = class extends koishi.Service {
4134
4149
  userAgent: koishi.Schema.string(),
4135
4150
  key: koishi.Schema.string().pattern(/^[0-9a-f]{32}$/).required()
4136
4151
  });
4137
- })(BiliAPI$1 || (BiliAPI$1 = {}));
4138
- var BiliAPI = BiliAPI$1;
4152
+ })(BiliAPI || (BiliAPI = {}));
4153
+ var bili_api_default = BiliAPI;
4139
4154
 
4140
4155
  //#endregion
4141
4156
  //#region src/bili_live.ts
@@ -4168,6 +4183,7 @@ var BLive = class extends koishi.Service {
4168
4183
  this.logger.warn(`${roomId}直播间连接未成功关闭`);
4169
4184
  }
4170
4185
  };
4186
+ var bili_live_default = BLive;
4171
4187
 
4172
4188
  //#endregion
4173
4189
  //#region src/index.ts
@@ -4209,11 +4225,11 @@ var ServerManager = class extends koishi.Service {
4209
4225
  registerPlugin = () => {
4210
4226
  if (this.servers.length !== 0) return false;
4211
4227
  try {
4212
- const ba = this.ctx.plugin(BiliAPI, {
4228
+ const ba = this.ctx.plugin(bili_api_default, {
4213
4229
  userAgent: globalConfig.userAgent,
4214
4230
  key: globalConfig.key
4215
4231
  });
4216
- const gi = this.ctx.plugin(GenerateImg, {
4232
+ const gi = this.ctx.plugin(generate_img_default, {
4217
4233
  filter: globalConfig.filter,
4218
4234
  removeBorder: globalConfig.removeBorder,
4219
4235
  cardColorStart: globalConfig.cardColorStart,
@@ -4225,7 +4241,7 @@ var ServerManager = class extends koishi.Service {
4225
4241
  font: globalConfig.font,
4226
4242
  followerDisplay: globalConfig.followerDisplay
4227
4243
  });
4228
- const cr = this.ctx.plugin(ComRegister, {
4244
+ const cr = this.ctx.plugin(command_register_default, {
4229
4245
  advancedSub: globalConfig.advancedSub,
4230
4246
  subs: globalConfig.subs,
4231
4247
  master: globalConfig.master,
@@ -4244,7 +4260,7 @@ var ServerManager = class extends koishi.Service {
4244
4260
  filter: globalConfig.filter,
4245
4261
  dynamicDebugMode: globalConfig.dynamicDebugMode
4246
4262
  });
4247
- const bl = this.ctx.plugin(BLive);
4263
+ const bl = this.ctx.plugin(bili_live_default);
4248
4264
  this.servers.push(ba);
4249
4265
  this.servers.push(bl);
4250
4266
  this.servers.push(gi);
package/lib/index.mjs CHANGED
@@ -157,6 +157,11 @@ async function withRetry(fn, maxAttempts = 3, delayMs = 1e3) {
157
157
  await new Promise((resolve$1) => setTimeout(resolve$1, delayMs * attempt));
158
158
  }
159
159
  }
160
+ function replaceButKeep(oldObj, newObj, keepKeys) {
161
+ const result = { ...newObj };
162
+ for (const key of keepKeys) result[key] = oldObj[key];
163
+ return result;
164
+ }
160
165
 
161
166
  //#endregion
162
167
  //#region src/type/index.ts
@@ -322,10 +327,11 @@ const stopwords = new Set([
322
327
  "之前",
323
328
  "某天"
324
329
  ]);
330
+ var stop_words_default = stopwords;
325
331
 
326
332
  //#endregion
327
333
  //#region src/command_register.ts
328
- var ComRegister$1 = class {
334
+ var ComRegister = class {
329
335
  static inject = [
330
336
  "bilibili-notify",
331
337
  "bilibili-notify-api",
@@ -675,10 +681,16 @@ var ComRegister$1 = class {
675
681
  return;
676
682
  }
677
683
  if (this.reciveSubTimes >= 1) await this.ctx["bilibili-notify"].restartPlugin();
678
- else await this.initAsyncPart(subs);
684
+ else {
685
+ this.processUname(subs);
686
+ await this.initAsyncPart(subs);
687
+ }
679
688
  this.reciveSubTimes++;
680
689
  });
681
690
  }
691
+ processUname(subs) {
692
+ for (const uname of Object.keys(subs)) subs[uname].uname = uname;
693
+ }
682
694
  async initAsyncPart(subs) {
683
695
  this.logger.info("获取到订阅信息,开始加载订阅...");
684
696
  const groupInfoResult = await this.getGroupInfo();
@@ -702,11 +714,11 @@ var ComRegister$1 = class {
702
714
  }
703
715
  mergeStopWords(stopWordsStr) {
704
716
  if (!stopWordsStr || stopWordsStr.trim() === "") {
705
- this.stopwords = new Set(stopwords);
717
+ this.stopwords = new Set(stop_words_default);
706
718
  return;
707
719
  }
708
720
  const additionalStopWords = stopWordsStr.split(",").map((word) => word.trim()).filter((word) => word !== "");
709
- this.stopwords = new Set([...stopwords, ...additionalStopWords]);
721
+ this.stopwords = new Set([...stop_words_default, ...additionalStopWords]);
710
722
  }
711
723
  initManagerAfterLoadSub() {
712
724
  for (const [uid, sub] of this.subManager) {
@@ -1181,9 +1193,9 @@ var ComRegister$1 = class {
1181
1193
  }
1182
1194
  return data;
1183
1195
  }
1184
- async sendLiveNotifyCard(liveType, followerDisplay, liveInfo, uid, liveNotifyMsg) {
1196
+ async sendLiveNotifyCard(liveType, liveData, liveInfo, uid, liveNotifyMsg) {
1185
1197
  const buffer = await withRetry(async () => {
1186
- return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface, followerDisplay, liveType, liveInfo.cardStyle.enable ? liveInfo.cardStyle : void 0);
1198
+ return await this.ctx["bilibili-notify-generate-img"].generateLiveImg(liveInfo.liveRoomInfo, liveInfo.masterInfo.username, liveInfo.masterInfo.userface, liveData, liveType, liveInfo.cardStyle.enable ? liveInfo.cardStyle : void 0);
1187
1199
  }, 1).catch((e) => {
1188
1200
  this.logger.error(`liveDetect generateLiveImg() 推送卡片生成失败,原因:${e.message}`);
1189
1201
  });
@@ -1205,9 +1217,12 @@ var ComRegister$1 = class {
1205
1217
  const danmakuWeightRecord = {};
1206
1218
  const danmakuMakerRecord = {};
1207
1219
  let liveStatus = false;
1208
- const liveRoomInfo = {};
1220
+ let liveRoomInfo;
1209
1221
  let masterInfo;
1210
- let watchedNum;
1222
+ const liveData = {
1223
+ watchedNum: "0",
1224
+ likedNum: "0"
1225
+ };
1211
1226
  const liveMsgObj = this.liveMsgManager.get(sub.uid);
1212
1227
  const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
1213
1228
  this.logger.info("开始制作弹幕词云");
@@ -1249,9 +1264,9 @@ var ComRegister$1 = class {
1249
1264
  return;
1250
1265
  }
1251
1266
  liveTime = liveRoomInfo.live_time;
1252
- const watched = watchedNum || "暂未获取到";
1267
+ const watched = liveData.watchedNum || "暂未获取到";
1253
1268
  const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
1254
- await this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
1269
+ await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: watched }, {
1255
1270
  liveRoomInfo,
1256
1271
  masterInfo,
1257
1272
  cardStyle: sub.customCardStyle
@@ -1267,24 +1282,18 @@ var ComRegister$1 = class {
1267
1282
  };
1268
1283
  const useLiveRoomInfo = async (liveType) => {
1269
1284
  let flag = true;
1270
- const liveRoomInfoData = await this.getLiveRoomInfo(sub.roomid).catch(() => {
1285
+ const data = await this.getLiveRoomInfo(sub.roomid).catch(() => {
1271
1286
  flag = false;
1272
- return null;
1273
1287
  });
1274
- if (!flag || !liveRoomInfoData || !liveRoomInfoData.uid) {
1288
+ if (!flag || !data || !data.uid) {
1275
1289
  flag = false;
1276
1290
  return flag;
1277
1291
  }
1278
1292
  if (liveType === LiveType.StartBroadcasting || liveType === LiveType.FirstLiveBroadcast) {
1279
- liveRoomInfo.uid = liveRoomInfoData.uid;
1280
- liveRoomInfo.live_time = liveRoomInfoData.live_time;
1281
- liveRoomInfo.short_id = liveRoomInfoData.short_id;
1282
- liveRoomInfo.room_id = liveRoomInfoData.room_id;
1283
- liveRoomInfo.online_max = 0;
1293
+ liveRoomInfo = data;
1294
+ return;
1284
1295
  }
1285
- liveRoomInfo.live_status = liveRoomInfoData.live_status;
1286
- liveRoomInfo.online = liveRoomInfoData.online;
1287
- if (liveRoomInfo.online > liveRoomInfo.online_max) liveRoomInfo.online_max = liveRoomInfo.online;
1296
+ liveRoomInfo = replaceButKeep(liveRoomInfo, data, ["live_time"]);
1288
1297
  };
1289
1298
  const LIVE_EVENT_COOLDOWN = 10 * 1e3;
1290
1299
  let lastLiveStart = 0;
@@ -1309,7 +1318,10 @@ var ComRegister$1 = class {
1309
1318
  this.broadcastToTargets(sub.uid, content, PushType.Superchat);
1310
1319
  },
1311
1320
  onWatchedChange: ({ body }) => {
1312
- watchedNum = body.text_small;
1321
+ liveData.watchedNum = body.text_small;
1322
+ },
1323
+ onLikedChange: ({ body }) => {
1324
+ liveData.likedNum = body.count.toString();
1313
1325
  },
1314
1326
  onGuardBuy: ({ body }) => {
1315
1327
  const content = h("message", [h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`)]);
@@ -1335,9 +1347,9 @@ var ComRegister$1 = class {
1335
1347
  this.logger.info(`开播粉丝数:${masterInfo.liveOpenFollowerNum}`);
1336
1348
  liveTime = liveRoomInfo?.live_time || DateTime.now().toFormat("yyyy-MM-dd HH:mm:ss");
1337
1349
  const diffTime = await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime);
1338
- const follower = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
1339
- const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower", follower).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
1340
- await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1350
+ const followerNum = masterInfo.liveOpenFollowerNum >= 1e4 ? `${(masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : masterInfo.liveOpenFollowerNum.toString();
1351
+ const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower", followerNum).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
1352
+ await this.sendLiveNotifyCard(LiveType.StartBroadcasting, { fansNum: followerNum }, {
1341
1353
  liveRoomInfo,
1342
1354
  masterInfo,
1343
1355
  cardStyle: sub.customCardStyle
@@ -1373,7 +1385,7 @@ var ComRegister$1 = class {
1373
1385
  return liveFollowerChangeNum <= -1e4 ? `${(liveFollowerChangeNum / 1e4).toFixed(1)}万` : liveFollowerChangeNum.toString();
1374
1386
  })();
1375
1387
  const liveEndMsg = liveMsgObj.customLiveEnd.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
1376
- await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1388
+ await this.sendLiveNotifyCard(LiveType.StopBroadcast, { fansChanged: followerChange }, {
1377
1389
  liveRoomInfo,
1378
1390
  masterInfo,
1379
1391
  cardStyle: sub.customCardStyle
@@ -1391,9 +1403,9 @@ var ComRegister$1 = class {
1391
1403
  this.logger.info(`当前粉丝数:${masterInfo.liveOpenFollowerNum}`);
1392
1404
  if (liveRoomInfo.live_status === 1) {
1393
1405
  liveTime = liveRoomInfo.live_time;
1394
- const watched = watchedNum || "暂未获取到";
1406
+ const watched = liveData.watchedNum || "暂未获取到";
1395
1407
  const liveMsg = liveMsgObj.customLive.replace("-name", masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(liveTime)).replace("-watched", watched).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`);
1396
- if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, watched, {
1408
+ if (this.config.restartPush) this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: watched }, {
1397
1409
  liveRoomInfo,
1398
1410
  masterInfo,
1399
1411
  cardStyle: sub.customCardStyle
@@ -1448,7 +1460,7 @@ var ComRegister$1 = class {
1448
1460
  LiveAPIStatus.liveStartTimeInit = true;
1449
1461
  }
1450
1462
  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
- await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1463
+ await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: "API" }, {
1452
1464
  liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1453
1465
  masterInfo: LiveAPIStatus.masterInfo,
1454
1466
  cardStyle: sub.customCardStyle
@@ -1481,7 +1493,7 @@ var ComRegister$1 = class {
1481
1493
  return liveFollowerChangeNum <= -1e4 ? `${liveFollowerChangeNum.toFixed(1)}万` : liveFollowerChangeNum.toString();
1482
1494
  })();
1483
1495
  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");
1484
- await this.sendLiveNotifyCard(LiveType.StopBroadcast, followerChange, {
1496
+ await this.sendLiveNotifyCard(LiveType.StopBroadcast, { fansChanged: followerChange }, {
1485
1497
  liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1486
1498
  masterInfo: LiveAPIStatus.masterInfo,
1487
1499
  cardStyle: sub.customCardStyle
@@ -1497,9 +1509,9 @@ var ComRegister$1 = class {
1497
1509
  }
1498
1510
  LiveAPIStatus.liveStartTime = LiveAPIStatus.liveRoomInfo.live_time;
1499
1511
  LiveAPIStatus.liveStartTimeInit = true;
1500
- const follower = LiveAPIStatus.masterInfo.liveOpenFollowerNum >= 1e4 ? `${(LiveAPIStatus.masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : LiveAPIStatus.masterInfo.liveOpenFollowerNum.toString();
1501
- 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}`);
1502
- await this.sendLiveNotifyCard(LiveType.StartBroadcasting, follower, {
1512
+ const followerNum = LiveAPIStatus.masterInfo.liveOpenFollowerNum >= 1e4 ? `${(LiveAPIStatus.masterInfo.liveOpenFollowerNum / 1e4).toFixed(1)}万` : LiveAPIStatus.masterInfo.liveOpenFollowerNum.toString();
1513
+ const liveStartMsg = liveMsgObj.customLiveStart.replace("-name", LiveAPIStatus.masterInfo.username).replace("-time", await this.ctx["bilibili-notify-generate-img"].getTimeDifference(LiveAPIStatus.liveStartTime)).replace("-follower", followerNum).replaceAll("\\n", "\n").replace("-link", `https://live.bilibili.com/${LiveAPIStatus.liveRoomInfo.short_id === 0 ? LiveAPIStatus.liveRoomInfo.room_id : LiveAPIStatus.liveRoomInfo.short_id}`);
1514
+ await this.sendLiveNotifyCard(LiveType.StartBroadcasting, { fansNum: followerNum }, {
1503
1515
  liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1504
1516
  masterInfo: LiveAPIStatus.masterInfo,
1505
1517
  cardStyle: sub.customCardStyle
@@ -1520,7 +1532,7 @@ var ComRegister$1 = class {
1520
1532
  LiveAPIStatus.liveStartTimeInit = true;
1521
1533
  }
1522
1534
  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}`);
1523
- await this.sendLiveNotifyCard(LiveType.LiveBroadcast, "API", {
1535
+ await this.sendLiveNotifyCard(LiveType.LiveBroadcast, { watchedNum: "API" }, {
1524
1536
  liveRoomInfo: LiveAPIStatus.liveRoomInfo,
1525
1537
  masterInfo: LiveAPIStatus.masterInfo,
1526
1538
  cardStyle: sub.customCardStyle
@@ -1837,8 +1849,8 @@ var ComRegister$1 = class {
1837
1849
  }),
1838
1850
  dynamicDebugMode: Schema.boolean().required()
1839
1851
  });
1840
- })(ComRegister$1 || (ComRegister$1 = {}));
1841
- var ComRegister = ComRegister$1;
1852
+ })(ComRegister || (ComRegister = {}));
1853
+ var command_register_default = ComRegister;
1842
1854
 
1843
1855
  //#endregion
1844
1856
  //#region src/database.ts
@@ -1874,13 +1886,16 @@ const DYNAMIC_TYPE_COURSES_SEASON = "DYNAMIC_TYPE_COURSES_SEASON";
1874
1886
  const DYNAMIC_TYPE_LIVE_RCMD = "DYNAMIC_TYPE_LIVE_RCMD";
1875
1887
  const DYNAMIC_TYPE_UGC_SEASON = "DYNAMIC_TYPE_UGC_SEASON";
1876
1888
  const ADDITIONAL_TYPE_RESERVE = "ADDITIONAL_TYPE_RESERVE";
1877
- var GenerateImg$1 = class extends Service {
1889
+ var GenerateImg = class extends Service {
1878
1890
  static inject = ["puppeteer"];
1879
1891
  giConfig;
1880
1892
  constructor(ctx, config) {
1881
1893
  super(ctx, "bilibili-notify-generate-img");
1882
1894
  this.giConfig = config;
1883
1895
  }
1896
+ numberToStr(num) {
1897
+ return num > 1e4 ? `${(num / 1e4).toFixed(1)}万` : num.toString();
1898
+ }
1884
1899
  async imgHandler(html) {
1885
1900
  const htmlPath = `file://${__dirname.replaceAll("\\", "/")}/page/0.html`;
1886
1901
  const page = await this.ctx.puppeteer.page();
@@ -1901,7 +1916,7 @@ var GenerateImg$1 = class extends Service {
1901
1916
  await page.close();
1902
1917
  return buffer;
1903
1918
  }
1904
- async generateLiveImg(data, username, userface, followerDisplay, liveStatus, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
1919
+ async generateLiveImg(data, username, userface, liveData, liveStatus, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
1905
1920
  const [titleStatus, liveTime, cover] = await this.getLiveStatus(data.live_time, liveStatus);
1906
1921
  const fontURL = pathToFileURL(resolve(__dirname, "font/HYZhengYuan-75W.ttf"));
1907
1922
  const html = `
@@ -2031,14 +2046,14 @@ var GenerateImg$1 = class extends Service {
2031
2046
  </div>
2032
2047
  ${this.giConfig.hideDesc ? "" : `<p class="card-text">${data.description ? data.description : "这个主播很懒,什么简介都没写"}</p>`}
2033
2048
  <p class="card-link">
2034
- <span>${liveStatus === 3 ? "本场直播最高人气:" : "人气:"}${data.online > 1e4 ? `${(data.online / 1e4).toFixed(1)}万` : data.online}</span>
2049
+ <span>${liveStatus === 3 ? `本场直播最高人气:${this.numberToStr(data.online_max)}` : `人气:${this.numberToStr(data.online)}`}</span>
2035
2050
  <span>分区名称:${data.area_name}</span>
2036
2051
  </p>
2037
2052
  <p class="card-link">
2038
2053
  <span>${liveTime}</span>
2039
2054
  ${this.giConfig.followerDisplay ? `
2040
2055
  <span>
2041
- ${liveStatus === 1 ? `当前粉丝数:${followerDisplay}` : liveStatus === 2 ? `${followerDisplay !== "API" ? `累计观看人数:${followerDisplay}` : ""}` : liveStatus === 3 ? `粉丝数变化:${followerDisplay}` : ""}
2056
+ ${liveStatus === 1 ? `当前粉丝数:${liveData.fansNum || "暂未获取到"}` : liveStatus === 2 ? `${liveData.watchedNum !== "API" ? `累计观看人数:${liveData.watchedNum}` : ""}` : liveStatus === 3 ? `粉丝数变化:${liveData.fansChanged}` : ""}
2042
2057
  </span>` : ""}
2043
2058
  </p>
2044
2059
  </div>
@@ -3338,8 +3353,8 @@ var GenerateImg$1 = class extends Service {
3338
3353
  hideDesc: Schema.boolean(),
3339
3354
  followerDisplay: Schema.boolean()
3340
3355
  });
3341
- })(GenerateImg$1 || (GenerateImg$1 = {}));
3342
- var GenerateImg = GenerateImg$1;
3356
+ })(GenerateImg || (GenerateImg = {}));
3357
+ var generate_img_default = GenerateImg;
3343
3358
 
3344
3359
  //#endregion
3345
3360
  //#region src/bili_api.ts
@@ -3434,7 +3449,7 @@ const COPY_USER_TO_GROUP = "https://api.bilibili.com/x/relation/tags/copyUsers";
3434
3449
  const GET_RELATION_GROUP_DETAIL = "https://api.bilibili.com/x/relation/tag";
3435
3450
  const GET_LIVE_ROOM_INFO_STREAM_KEY = "https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo";
3436
3451
  const GET_LIVE_ROOMS_INFO = "https://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids";
3437
- var BiliAPI$1 = class extends Service {
3452
+ var BiliAPI = class extends Service {
3438
3453
  static inject = ["database", "notifier"];
3439
3454
  jar;
3440
3455
  client;
@@ -4116,8 +4131,8 @@ var BiliAPI$1 = class extends Service {
4116
4131
  userAgent: Schema.string(),
4117
4132
  key: Schema.string().pattern(/^[0-9a-f]{32}$/).required()
4118
4133
  });
4119
- })(BiliAPI$1 || (BiliAPI$1 = {}));
4120
- var BiliAPI = BiliAPI$1;
4134
+ })(BiliAPI || (BiliAPI = {}));
4135
+ var bili_api_default = BiliAPI;
4121
4136
 
4122
4137
  //#endregion
4123
4138
  //#region src/bili_live.ts
@@ -4150,6 +4165,7 @@ var BLive = class extends Service {
4150
4165
  this.logger.warn(`${roomId}直播间连接未成功关闭`);
4151
4166
  }
4152
4167
  };
4168
+ var bili_live_default = BLive;
4153
4169
 
4154
4170
  //#endregion
4155
4171
  //#region src/index.ts
@@ -4191,11 +4207,11 @@ var ServerManager = class extends Service {
4191
4207
  registerPlugin = () => {
4192
4208
  if (this.servers.length !== 0) return false;
4193
4209
  try {
4194
- const ba = this.ctx.plugin(BiliAPI, {
4210
+ const ba = this.ctx.plugin(bili_api_default, {
4195
4211
  userAgent: globalConfig.userAgent,
4196
4212
  key: globalConfig.key
4197
4213
  });
4198
- const gi = this.ctx.plugin(GenerateImg, {
4214
+ const gi = this.ctx.plugin(generate_img_default, {
4199
4215
  filter: globalConfig.filter,
4200
4216
  removeBorder: globalConfig.removeBorder,
4201
4217
  cardColorStart: globalConfig.cardColorStart,
@@ -4207,7 +4223,7 @@ var ServerManager = class extends Service {
4207
4223
  font: globalConfig.font,
4208
4224
  followerDisplay: globalConfig.followerDisplay
4209
4225
  });
4210
- const cr = this.ctx.plugin(ComRegister, {
4226
+ const cr = this.ctx.plugin(command_register_default, {
4211
4227
  advancedSub: globalConfig.advancedSub,
4212
4228
  subs: globalConfig.subs,
4213
4229
  master: globalConfig.master,
@@ -4226,7 +4242,7 @@ var ServerManager = class extends Service {
4226
4242
  filter: globalConfig.filter,
4227
4243
  dynamicDebugMode: globalConfig.dynamicDebugMode
4228
4244
  });
4229
- const bl = this.ctx.plugin(BLive);
4245
+ const bl = this.ctx.plugin(bili_live_default);
4230
4246
  this.servers.push(ba);
4231
4247
  this.servers.push(bl);
4232
4248
  this.servers.push(gi);
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.11-alpha.0",
4
+ "version": "3.3.11-alpha.2",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [