koishi-plugin-bilibili-notify 3.2.0-alpha.0 → 3.2.0-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.
@@ -1232,25 +1232,29 @@ class ComRegister {
1232
1232
  liveStatus.live = true;
1233
1233
  // 初始化主播和直播间信息
1234
1234
  await useMasterAndLiveRoomInfo(type_1.LiveType.FirstLiveBroadcast, liveStatus);
1235
+ // 判断是否需要设置开播时间
1236
+ if (!liveStatus.liveStartTimeInit) {
1237
+ // 设置开播时间
1238
+ liveStatus.liveStartTime = liveStatus.liveRoomInfo.live_time;
1239
+ // 设置开播时间初始化状态
1240
+ liveStatus.liveStartTimeInit = true;
1241
+ }
1235
1242
  // 设置直播中消息
1236
1243
  const liveMsg = this.config.customLive
1237
1244
  ? this.config.customLive
1238
1245
  .replace("-name", liveStatus.masterInfo.username)
1239
1246
  .replace("-time", await this.ctx.gi.getTimeDifference(liveStatus.liveStartTime))
1240
- .replace("-watched", "暂未获取到")
1247
+ .replace("-watched", "")
1241
1248
  .replace("\\n", "\n")
1242
1249
  .replace("-link", `https://live.bilibili.com/${liveStatus.liveRoomInfo.short_id === 0 ? liveStatus.liveRoomInfo.room_id : liveStatus.liveRoomInfo.short_id}`)
1243
1250
  : null;
1244
1251
  // 发送直播通知卡片
1245
- await this.sendLiveNotifyCard(type_1.LiveType.LiveBroadcast, "暂未获取到", {
1252
+ await this.sendLiveNotifyCard(type_1.LiveType.LiveBroadcast, "API", {
1246
1253
  liveRoomInfo: liveStatus.liveRoomInfo,
1247
1254
  masterInfo: liveStatus.masterInfo,
1248
1255
  cardStyle: sub.card,
1249
1256
  }, sub.target, liveMsg);
1250
1257
  }
1251
- else {
1252
- useMasterAndLiveRoomInfo(type_1.LiveType.NotLiveBroadcast, liveStatus);
1253
- }
1254
1258
  }
1255
1259
  // 定义函数
1256
1260
  const handler = async () => {
@@ -1377,19 +1381,17 @@ class ComRegister {
1377
1381
  // 设置开播时间初始化状态
1378
1382
  liveStatus.liveStartTimeInit = true;
1379
1383
  }
1380
- // 获取watched
1381
- const watched = "暂未获取到";
1382
1384
  // 设置直播中消息
1383
1385
  const liveMsg = this.config.customLive
1384
1386
  ? this.config.customLive
1385
1387
  .replace("-name", liveStatus.masterInfo.username)
1386
1388
  .replace("-time", await this.ctx.gi.getTimeDifference(liveStatus.liveStartTime))
1387
- .replace("-watched", watched)
1389
+ .replace("-watched", "")
1388
1390
  .replace("\\n", "\n")
1389
1391
  .replace("-link", `https://live.bilibili.com/${liveStatus.liveRoomInfo.short_id === 0 ? liveStatus.liveRoomInfo.room_id : liveStatus.liveRoomInfo.short_id}`)
1390
1392
  : null;
1391
1393
  // 发送直播通知卡片
1392
- await this.sendLiveNotifyCard(type_1.LiveType.LiveBroadcast, watched, {
1394
+ await this.sendLiveNotifyCard(type_1.LiveType.LiveBroadcast, "API", {
1393
1395
  liveRoomInfo: liveStatus.liveRoomInfo,
1394
1396
  masterInfo: liveStatus.masterInfo,
1395
1397
  cardStyle: sub.card,
@@ -194,7 +194,7 @@ class GenerateImg extends koishi_1.Service {
194
194
  ${liveStatus === 1
195
195
  ? `当前粉丝数:${followerDisplay}`
196
196
  : liveStatus === 2
197
- ? `累计观看人数:${followerDisplay}`
197
+ ? `${followerDisplay !== "API" ? `粉丝数变化:${followerDisplay}` : ""}`
198
198
  : liveStatus === 3
199
199
  ? `粉丝数变化:${followerDisplay}`
200
200
  : ""}
package/lib/index.js CHANGED
@@ -324,7 +324,8 @@ exports.Config = koishi_1.Schema.object({
324
324
  liveDetectType: koishi_1.Schema.union(["WS", "API"])
325
325
  .role("radio")
326
326
  .default("WS")
327
- .description("直播检测方式,WS为连接到B站弹幕服务器,API为通过轮询发送请求监测,默认使用WS检测"),
327
+ .description("直播检测方式,WS为连接到B站弹幕服务器,API为通过轮询发送请求监测,默认使用WS检测")
328
+ .experimental(),
328
329
  restartPush: koishi_1.Schema.boolean()
329
330
  .default(true)
330
331
  .description("插件重启后,如果订阅的主播正在直播,是否进行一次推送,默认开启"),
@@ -396,6 +397,5 @@ exports.Config = koishi_1.Schema.object({
396
397
  debug: koishi_1.Schema.object({}).description("调试设置"),
397
398
  dynamicDebugMode: koishi_1.Schema.boolean()
398
399
  .default(false)
399
- .description("动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试")
400
- .experimental(),
400
+ .description("动态调试模式,开启后会在控制台输出动态推送的详细信息,用于调试"),
401
401
  });
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.2.0-alpha.0",
4
+ "version": "3.2.0-alpha.1",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -249,6 +249,7 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
249
249
  - ver 3.1.7-alpha.3 修复:推送视频类动态报错;
250
250
  - ver 3.1.7 修复:第一次使用插件报错 `TypeError: Cannot read properties of undefined (reading 'dynamic_group_id')`
251
251
  - ver 3.2.0-alpha.0 新增:直播检测 `API` 模式; 优化:提升直播检测 `WS` 模式使用体验;
252
+ - ver 3.2.0-alpha.1 修复:直播检测 `API` 模式,中途加入推送语无法正确显示直播时长;
252
253
 
253
254
  ## 交流群
254
255