koishi-plugin-bilibili-notify 1.2.0-rc.3 → 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;
@@ -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,
@@ -454,16 +455,15 @@ class ComRegister {
454
455
  catch (e) {
455
456
  return 'bili sub指令 getMasterInfo() 网络请求失败,请重试';
456
457
  }
457
- this.logger.info(session.event.platform);
458
458
  // 需要订阅直播
459
459
  if (liveMsg) {
460
- await session.execute(`bili live ${roomId} ${targetId.split(',').join(' ')} -b ${session.event.platform}`);
460
+ await session.execute(`bili live ${roomId} ${targetId.split(',').join(' ')}`);
461
461
  // 发送订阅消息通知
462
462
  await session.send(`订阅${userData.info.uname}直播通知`);
463
463
  }
464
464
  // 需要订阅动态
465
465
  if (dynamicMsg) {
466
- await session.execute(`bili dynamic ${mid} ${targetId.split(',').join(' ')} -b ${session.event.platform}`);
466
+ await session.execute(`bili dynamic ${mid} ${targetId.split(',').join(' ')}`);
467
467
  // 发送订阅消息通知
468
468
  await session.send(`订阅${userData.info.uname}动态通知`);
469
469
  }
@@ -472,31 +472,28 @@ class ComRegister {
472
472
  });
473
473
  biliCom
474
474
  .subcommand('.dynamic <uid:string> <...guildId:string>', '订阅用户动态推送', { hidden: true })
475
- .option('bot', '-b <type:string>')
475
+ // .option('bot', '-b <type:string>')
476
476
  .usage('订阅用户动态推送')
477
477
  .example('bili dynamic 1194210119 订阅UID为1194210119的动态')
478
- .action(async ({ session, options }, uid, ...guildId) => {
478
+ .action(async ({ session }, uid, ...guildId) => {
479
479
  this.logger.info('调用bili.dynamic指令');
480
- this.logger.info('Platform:', options.bot);
481
480
  // 如果uid为空则返回
482
481
  if (!uid)
483
482
  return `${uid}非法调用 dynamic 指令`; // 用户uid不能为空
484
483
  if (!guildId)
485
484
  return `${uid}非法调用 dynamic 指令`; // 目标群组或频道不能为空
486
- if (!options.bot) {
487
- this.logger.warn(`${uid}非法调用 dynamic 指令,未传入订阅平台`);
488
- return `${uid}非法调用 dynamic 指令`;
489
- }
485
+ /* if (!options.bot) {
486
+ this.logger.warn(`${uid}非法调用 dynamic 指令,未传入订阅平台`)
487
+ return `${uid}非法调用 dynamic 指令`
488
+ } */
490
489
  // 寻找对应订阅管理对象
491
490
  const index = this.subManager.findIndex(sub => sub.uid === uid);
492
491
  // 不存在则直接返回
493
- if (index === -1) {
494
- session.send('请勿直接调用该指令');
495
- return;
496
- }
492
+ if (index === -1)
493
+ return '请勿直接调用该指令';
497
494
  // 获取对应Bot
498
495
  let bot;
499
- switch (options.bot) {
496
+ switch (session.event.platform) {
500
497
  case 'qq':
501
498
  bot = this.qqBot;
502
499
  break;
@@ -524,29 +521,27 @@ class ComRegister {
524
521
  });
525
522
  biliCom
526
523
  .subcommand('.live <roomId:string> <...guildId:string>', '订阅主播开播通知', { hidden: true })
527
- .option('bot', '-b <type:string>')
524
+ // .option('bot', '-b <type:string>')
528
525
  .usage('订阅主播开播通知')
529
526
  .example('bili live 26316137 订阅房间号为26316137的直播间')
530
- .action(async ({ options }, roomId, ...guildId) => {
527
+ .action(async ({ session }, roomId, ...guildId) => {
531
528
  this.logger.info('调用bili.live指令');
532
- this.logger.info('Platform:', options.bot);
533
529
  // 如果room_id为空则返回
534
530
  if (!roomId)
535
531
  return `${roomId}非法调用 dynamic 指令`; // 订阅主播房间号不能为空
536
532
  if (!guildId)
537
533
  return `${roomId}非法调用 dynamic 指令`; // 目标群组或频道不能为空
538
- if (!options.bot) {
539
- this.logger.warn(`${roomId}非法调用 dynamic 指令,未传入推送平台`);
540
- return `${roomId}非法调用 dynamic 指令`;
541
- }
542
- // 保存到订阅管理对象
543
- const index = this.subManager.findIndex(sub => sub.roomId === roomId);
534
+ /* if (!options.bot) {
535
+ this.logger.warn(`${roomId}非法调用 dynamic 指令,未传入推送平台`)
536
+ return `${roomId}非法调用 dynamic 指令`
537
+ } */
544
538
  // 要订阅的对象不在订阅管理对象中,直接返回
539
+ const index = this.subManager.findIndex(sub => sub.roomId === roomId);
545
540
  if (index === -1)
546
541
  return '请勿直接调用该指令';
547
542
  // 获取对应Bot
548
543
  let bot;
549
- switch (options.bot) {
544
+ switch (session.event.platform) {
550
545
  case 'qq':
551
546
  bot = this.qqBot;
552
547
  break;
@@ -1065,6 +1060,7 @@ class ComRegister {
1065
1060
  uid: sub.uid,
1066
1061
  roomId: sub.room_id,
1067
1062
  targetId: sub.targetId,
1063
+ platform: sub.platform,
1068
1064
  live: +sub.live === 1 ? true : false,
1069
1065
  dynamic: +sub.dynamic === 1 ? true : false,
1070
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.3",
4
+ "version": "1.2.0-rc.4",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],