koishi-plugin-bilibili-notify 1.2.0-rc.2 → 1.2.0-rc.4

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.
@@ -12,6 +12,7 @@ declare class ComRegister {
12
12
  uid: string;
13
13
  roomId: string;
14
14
  targetId: string;
15
+ platform: string;
15
16
  live: boolean;
16
17
  dynamic: boolean;
17
18
  liveDispose: Function;
@@ -332,7 +332,7 @@ class ComRegister {
332
332
  content = await ctx.biliAPI.getUserInfo(mid);
333
333
  }
334
334
  catch (e) {
335
- return 'bili sub getUserInfo() 本次网络请求失败';
335
+ return 'bili sub getUserInfo() 本次网络请求失败,请重试';
336
336
  }
337
337
  // 判断是否有其他问题
338
338
  if (content.code !== 0) {
@@ -440,6 +440,7 @@ class ComRegister {
440
440
  uid: mid,
441
441
  targetId,
442
442
  roomId,
443
+ platform: session.event.platform,
443
444
  live: liveMsg,
444
445
  dynamic: dynamicMsg,
445
446
  liveDispose: null,
@@ -456,13 +457,13 @@ class ComRegister {
456
457
  }
457
458
  // 需要订阅直播
458
459
  if (liveMsg) {
459
- await session.execute(`bili live ${roomId} ${targetId.split(',').join(' ')} -b ${session.event.platform}`);
460
+ await session.execute(`bili live ${roomId} ${targetId.split(',').join(' ')}`);
460
461
  // 发送订阅消息通知
461
462
  await session.send(`订阅${userData.info.uname}直播通知`);
462
463
  }
463
464
  // 需要订阅动态
464
465
  if (dynamicMsg) {
465
- await session.execute(`bili dynamic ${mid} ${targetId.split(',').join(' ')} -b ${session.event.platform}`);
466
+ await session.execute(`bili dynamic ${mid} ${targetId.split(',').join(' ')}`);
466
467
  // 发送订阅消息通知
467
468
  await session.send(`订阅${userData.info.uname}动态通知`);
468
469
  }
@@ -471,30 +472,28 @@ class ComRegister {
471
472
  });
472
473
  biliCom
473
474
  .subcommand('.dynamic <uid:string> <...guildId:string>', '订阅用户动态推送', { hidden: true })
474
- .option('bot', '-b <type:string>')
475
+ // .option('bot', '-b <type:string>')
475
476
  .usage('订阅用户动态推送')
476
477
  .example('bili dynamic 1194210119 订阅UID为1194210119的动态')
477
- .action(async ({ session, options }, uid, ...guildId) => {
478
+ .action(async ({ session }, uid, ...guildId) => {
478
479
  this.logger.info('调用bili.dynamic指令');
479
480
  // 如果uid为空则返回
480
481
  if (!uid)
481
482
  return `${uid}非法调用 dynamic 指令`; // 用户uid不能为空
482
483
  if (!guildId)
483
484
  return `${uid}非法调用 dynamic 指令`; // 目标群组或频道不能为空
484
- if (!options.bot) {
485
- this.logger.warn(`${uid}非法调用 dynamic 指令,未传入订阅平台`);
486
- return `${uid}非法调用 dynamic 指令`;
487
- }
485
+ /* if (!options.bot) {
486
+ this.logger.warn(`${uid}非法调用 dynamic 指令,未传入订阅平台`)
487
+ return `${uid}非法调用 dynamic 指令`
488
+ } */
488
489
  // 寻找对应订阅管理对象
489
490
  const index = this.subManager.findIndex(sub => sub.uid === uid);
490
491
  // 不存在则直接返回
491
- if (index === -1) {
492
- session.send('请勿直接调用该指令');
493
- return;
494
- }
492
+ if (index === -1)
493
+ return '请勿直接调用该指令';
495
494
  // 获取对应Bot
496
495
  let bot;
497
- switch (options.bot) {
496
+ switch (session.event.platform) {
498
497
  case 'qq':
499
498
  bot = this.qqBot;
500
499
  break;
@@ -522,28 +521,27 @@ class ComRegister {
522
521
  });
523
522
  biliCom
524
523
  .subcommand('.live <roomId:string> <...guildId:string>', '订阅主播开播通知', { hidden: true })
525
- .option('bot', '-b <type:string>')
524
+ // .option('bot', '-b <type:string>')
526
525
  .usage('订阅主播开播通知')
527
526
  .example('bili live 26316137 订阅房间号为26316137的直播间')
528
- .action(async ({ options }, roomId, ...guildId) => {
527
+ .action(async ({ session }, roomId, ...guildId) => {
529
528
  this.logger.info('调用bili.live指令');
530
529
  // 如果room_id为空则返回
531
530
  if (!roomId)
532
531
  return `${roomId}非法调用 dynamic 指令`; // 订阅主播房间号不能为空
533
532
  if (!guildId)
534
533
  return `${roomId}非法调用 dynamic 指令`; // 目标群组或频道不能为空
535
- if (!options.bot) {
536
- this.logger.warn(`${roomId}非法调用 dynamic 指令,未传入推送平台`);
537
- return `${roomId}非法调用 dynamic 指令`;
538
- }
539
- // 保存到订阅管理对象
540
- const index = this.subManager.findIndex(sub => sub.roomId === roomId);
534
+ /* if (!options.bot) {
535
+ this.logger.warn(`${roomId}非法调用 dynamic 指令,未传入推送平台`)
536
+ return `${roomId}非法调用 dynamic 指令`
537
+ } */
541
538
  // 要订阅的对象不在订阅管理对象中,直接返回
539
+ const index = this.subManager.findIndex(sub => sub.roomId === roomId);
542
540
  if (index === -1)
543
541
  return '请勿直接调用该指令';
544
542
  // 获取对应Bot
545
543
  let bot;
546
- switch (options.bot) {
544
+ switch (session.event.platform) {
547
545
  case 'qq':
548
546
  bot = this.qqBot;
549
547
  break;
@@ -1062,6 +1060,7 @@ class ComRegister {
1062
1060
  uid: sub.uid,
1063
1061
  roomId: sub.room_id,
1064
1062
  targetId: sub.targetId,
1063
+ platform: sub.platform,
1065
1064
  live: +sub.live === 1 ? true : false,
1066
1065
  dynamic: +sub.dynamic === 1 ? true : false,
1067
1066
  liveDispose: null,
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": "1.2.0-rc.2",
4
+ "version": "1.2.0-rc.4",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -109,6 +109,8 @@
109
109
  - ver 1.2.0-alpha.5 修复了与PostgreSQL不兼容的问题,优化了图片推送,增强了推送容错
110
110
  - ver 1.2.0-rc.0 现已支持自定义开播和下播提示语(实验性)
111
111
  - ver 1.2.0-rc.1 现已支持Telegram平台(实验性)
112
+ - ver 1.2.0-rc.2 添加更多日志输出
113
+ - ver 1.2.0-rc.3 针对Telegram的Bug测试版本
112
114
 
113
115
  ## 交流群
114
116
  801338523 使用问题或bug都可以在群里提出