koishi-plugin-bilibili-notify 3.0.1-alpha.0 → 3.0.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.
@@ -950,6 +950,7 @@ class ComRegister {
950
950
  .replace("-name", masterInfo.username)
951
951
  .replace("-time", await this.ctx.gi.getTimeDifference(liveTime))
952
952
  .replace("-watched", watched)
953
+ .replace("\\n", "\n")
953
954
  .replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`)
954
955
  : null;
955
956
  // 发送直播通知卡片
@@ -1028,6 +1029,7 @@ class ComRegister {
1028
1029
  .replace("-name", masterInfo.username)
1029
1030
  .replace("-time", await this.ctx.gi.getTimeDifference(liveTime))
1030
1031
  .replace("-follower", follower)
1032
+ .replace("\\n", "\n")
1031
1033
  .replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`)
1032
1034
  : null;
1033
1035
  // 推送开播通知
@@ -1070,6 +1072,7 @@ class ComRegister {
1070
1072
  .replace("-name", masterInfo.username)
1071
1073
  .replace("-time", await this.ctx.gi.getTimeDifference(liveTime))
1072
1074
  .replace("-follower_change", followerChange)
1075
+ .replace("\\n", "\n")
1073
1076
  : null;
1074
1077
  // 推送通知卡片
1075
1078
  await sendLiveNotifyCard(type_1.LiveType.StopBroadcast, followerChange, liveEndMsg);
@@ -1098,6 +1101,7 @@ class ComRegister {
1098
1101
  .replace("-name", masterInfo.username)
1099
1102
  .replace("-time", await this.ctx.gi.getTimeDifference(liveTime))
1100
1103
  .replace("-watched", watched)
1104
+ .replace("\\n", "\n")
1101
1105
  .replace("-link", `https://live.bilibili.com/${liveRoomInfo.short_id === 0 ? liveRoomInfo.room_id : liveRoomInfo.short_id}`)
1102
1106
  : null;
1103
1107
  // 发送直播通知卡片
@@ -1266,7 +1270,7 @@ class ComRegister {
1266
1270
  return { flag: true, msg: "用户订阅成功" };
1267
1271
  }
1268
1272
  async loadSubFromConfig(subs) {
1269
- for (const sub of subs) {
1273
+ await Promise.all(subs.map(async (sub) => {
1270
1274
  // logger
1271
1275
  this.logger.info(`加载订阅UID:${sub.uid}中...`);
1272
1276
  // 定义Data
@@ -1310,7 +1314,7 @@ class ComRegister {
1310
1314
  card: sub.card,
1311
1315
  });
1312
1316
  this.logger.info(`UID:${sub.uid}订阅加载完毕!`);
1313
- }
1317
+ }));
1314
1318
  }
1315
1319
  checkIfDynamicDetectIsNeeded() {
1316
1320
  // 检查是否有订阅对象需要动态监测
@@ -1320,7 +1324,7 @@ class ComRegister {
1320
1324
  enableDynamicDetect() {
1321
1325
  // 开始动态监测
1322
1326
  if (this.config.dynamicDebugMode) {
1323
- this.dynamicDispose = this.ctx.setInterval(this.debug_dynamicDetect(), 5 * 1000);
1327
+ this.dynamicDispose = this.ctx.setInterval(this.debug_dynamicDetect(), this.config.dynamicLoopTime * 1000);
1324
1328
  }
1325
1329
  else {
1326
1330
  this.dynamicDispose = this.ctx.setInterval(this.dynamicDetect(), this.config.dynamicLoopTime * 1000);
package/lib/index.d.ts CHANGED
@@ -33,6 +33,7 @@ export interface Config {
33
33
  userAgent: string;
34
34
  subTitle: {};
35
35
  sub: Array<{
36
+ name: string;
36
37
  uid: string;
37
38
  dynamic: boolean;
38
39
  live: boolean;
package/lib/index.js CHANGED
@@ -277,6 +277,7 @@ exports.Config = koishi_1.Schema.object({
277
277
  .description("设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111"),
278
278
  subTitle: koishi_1.Schema.object({}).description("订阅配置"),
279
279
  sub: koishi_1.Schema.array(koishi_1.Schema.object({
280
+ name: koishi_1.Schema.string().description("订阅用户昵称,只是给你自己看的(相当于备注),可填可不填"),
280
281
  uid: koishi_1.Schema.string().required().description("订阅用户UID"),
281
282
  dynamic: koishi_1.Schema.boolean().default(false).description("是否订阅用户动态"),
282
283
  live: koishi_1.Schema.boolean().default(false).description("是否订阅用户直播"),
@@ -370,14 +371,14 @@ exports.Config = koishi_1.Schema.object({
370
371
  .default(1)
371
372
  .description("设定间隔多长时间推送一次直播状态,单位为小时,默认为一小时"),
372
373
  customLiveStart: koishi_1.Schema.string()
373
- .default("-name开播啦,当前粉丝数:-follower -link")
374
- .description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name开播啦,会发送为xxxUP开播啦"),
374
+ .default("-name开播啦,当前粉丝数:-follower\\n-link")
375
+ .description("自定义开播提示语,-name代表UP昵称,-follower代表当前粉丝数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name开播啦,会发送为xxxUP开播啦"),
375
376
  customLive: koishi_1.Schema.string()
376
- .default("-name正在直播,目前已播-time,累计看过人数:-watched -link")
377
- .description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-watched代表累计看过人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用)。例如-name正在直播,会发送为xxxUP正在直播xxx"),
377
+ .default("-name正在直播,目前已播-time,累计看过人数:-watched\\n-link")
378
+ .description("自定义直播中提示语,-name代表UP昵称,-time代表开播时长,-watched代表累计看过人数,-link代表直播间链接(如果使用的是QQ官方机器人,请不要使用),\\n为换行。例如-name正在直播,会发送为xxxUP正在直播xxx"),
378
379
  customLiveEnd: koishi_1.Schema.string()
379
380
  .default("-name下播啦,本次直播了-time,粉丝数变化-follower_change")
380
- .description("自定义下播提示语,-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
381
+ .description("自定义下播提示语,-name代表UP昵称,-follower_change代表本场直播粉丝数变,-time代表开播时长,\\n为换行。例如-name下播啦,本次直播了-time,会发送为xxxUP下播啦,直播时长为xx小时xx分钟xx秒"),
381
382
  followerDisplay: koishi_1.Schema.boolean()
382
383
  .default(true)
383
384
  .description("粉丝数变化和看过本场直播的人数是否显示在推送卡片中"),
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.0.1-alpha.0",
4
+ "version": "3.0.1-alpha.1",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -214,6 +214,7 @@
214
214
  - ver 3.0.0-beta.2 新增:配置项 `sub.card`,能更改每个订阅的推送卡片样式,未更改的样式与全局样式保持一致
215
215
  - ver 3.0.0 优化:配置项 `sub.card` 添加实验性标识
216
216
  - ver 3.0.1-alpha.0 优化:动态推送逻辑
217
+ - ver 3.0.1-alpha.1 新增:直播提示语换行符,配置项 `sub.name` 为可选项; 修复:debug模式下动态监测5S一次; 优化:加载订阅
217
218
 
218
219
  ## 交流群
219
220