koishi-plugin-bilibili-notify 2.0.0-alpha.5 → 2.0.0-alpha.6

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.
@@ -44,7 +44,7 @@ declare class ComRegister {
44
44
  }>;
45
45
  getSubFromDatabase(ctx: Context): Promise<void>;
46
46
  unsubSingle(ctx: Context, id: string, type: number): string;
47
- checkIfUserThatIsSubDynAndUnsub(): void;
47
+ checkIfUserIsTheLastOneWhoSubDyn(): void;
48
48
  unsubAll(ctx: Context, uid: string): void;
49
49
  checkIfIsLogin(ctx: Context): Promise<boolean>;
50
50
  }
@@ -1012,7 +1012,7 @@ class ComRegister {
1012
1012
  // 相当于锁的作用,防止上一个循环没处理完
1013
1013
  let flag = true;
1014
1014
  // 定义发送直播通知卡片方法
1015
- const sendLiveNotifyCard = async (data, liveType, liveStartMsg, atAll) => {
1015
+ const sendLiveNotifyCard = async (data, liveType, liveNotifyMsg, atAll) => {
1016
1016
  // 定义变量
1017
1017
  let pic;
1018
1018
  let buffer;
@@ -1039,11 +1039,11 @@ class ComRegister {
1039
1039
  // 推送直播信息
1040
1040
  // pic 存在,使用的是render模式
1041
1041
  if (pic) {
1042
- const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg] });
1042
+ const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveNotifyMsg && liveNotifyMsg] });
1043
1043
  return await this.sendMsg(ctx, guildId, pic + msg, platform);
1044
1044
  }
1045
1045
  // pic不存在,说明使用的是page模式
1046
- const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveStartMsg && liveStartMsg] });
1046
+ const msg = (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [koishi_1.h.image(buffer, 'image/png'), atAll && (0, jsx_runtime_1.jsx)("at", { type: "all" }), liveNotifyMsg && liveNotifyMsg] });
1047
1047
  await this.sendMsg(ctx, guildId, msg, platform);
1048
1048
  };
1049
1049
  // 定义获取主播信息方法
@@ -1188,10 +1188,10 @@ class ComRegister {
1188
1188
  // 到时间重新计时
1189
1189
  timer = 0;
1190
1190
  // 定义直播中通知消息
1191
- const liveMsg = this.config.customLive
1191
+ const liveMsg = this.config.customLive ? this.config.customLive
1192
1192
  .replace('-name', username)
1193
1193
  .replace('-time', await ctx.gi.getTimeDifference(liveTime))
1194
- .replace('-link', `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`);
1194
+ .replace('-link', `https://live.bilibili.com/${data.short_id === 0 ? data.room_id : data.short_id}`) : '';
1195
1195
  // 发送直播通知卡片
1196
1196
  sendLiveNotifyCard(data, LiveType.LiveBroadcast, liveMsg);
1197
1197
  }
@@ -1530,7 +1530,7 @@ class ComRegister {
1530
1530
  // num--
1531
1531
  this.num--;
1532
1532
  // 判断是否还存在订阅了动态的对象,不存在则停止动态监测
1533
- this.checkIfUserThatIsSubDynAndUnsub();
1533
+ this.checkIfUserIsTheLastOneWhoSubDyn();
1534
1534
  };
1535
1535
  try {
1536
1536
  switch (type) {
@@ -1575,7 +1575,7 @@ class ComRegister {
1575
1575
  // 取消订阅
1576
1576
  this.subManager[index].dynamic = false;
1577
1577
  // 判断是否还存在订阅了动态的对象,不存在则停止动态监测
1578
- this.checkIfUserThatIsSubDynAndUnsub();
1578
+ this.checkIfUserIsTheLastOneWhoSubDyn();
1579
1579
  // 如果没有对这个UP的任何订阅,则移除
1580
1580
  if (checkIfNoSubExist(sub)) {
1581
1581
  // 从管理对象中移除
@@ -1596,7 +1596,7 @@ class ComRegister {
1596
1596
  this.updateSubNotifier(ctx);
1597
1597
  }
1598
1598
  }
1599
- checkIfUserThatIsSubDynAndUnsub() {
1599
+ checkIfUserIsTheLastOneWhoSubDyn() {
1600
1600
  if (this.subManager.some(sub => sub.dynamic)) {
1601
1601
  // 停止动态监测
1602
1602
  this.dynamicDispose();
@@ -1609,7 +1609,7 @@ class ComRegister {
1609
1609
  if (sub.live)
1610
1610
  await this.subManager[i].liveDispose();
1611
1611
  // 判断是否还存在订阅了动态的对象,不存在则停止动态监测
1612
- this.checkIfUserThatIsSubDynAndUnsub();
1612
+ this.checkIfUserIsTheLastOneWhoSubDyn();
1613
1613
  // 从数据库中删除订阅
1614
1614
  await ctx.database.remove('bilibili', { uid: this.subManager[i].uid });
1615
1615
  // 将该订阅对象从订阅管理对象中移除
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": "2.0.0-alpha.5",
4
+ "version": "2.0.0-alpha.6",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
@@ -183,6 +183,7 @@
183
183
  - ver 2.0.0-alpha.3 修复:订阅和取消订阅的bug,下播通知的bug
184
184
  - ver 2.0.0-alpha.4 修复:初次订阅后不推送动态的bug 优化:下播不再发送链接
185
185
  - ver 2.0.0-alpha.5 移除:选项pushUrl,选项platform 新增:选项customLive,主人账号中platform选项。支持多平台,且可同时推送不同平台,单个UP主只能推送一个平台
186
+ - ver 2.0.0-alpha.6 修复:直播推送发送失败的bug
186
187
 
187
188
  ## 交流群
188
189