koishi-plugin-bilibili-notify 1.2.3-rc.7 → 1.2.3-rc.9
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.
- package/lib/comRegister.js +40 -36
- package/lib/database.js +2 -2
- package/lib/index.js +2 -2
- package/package.json +1 -1
- package/readme.md +2 -0
package/lib/comRegister.js
CHANGED
|
@@ -360,7 +360,7 @@ class ComRegister {
|
|
|
360
360
|
content = await ctx.biliAPI.getUserInfo(mid);
|
|
361
361
|
}
|
|
362
362
|
catch (e) {
|
|
363
|
-
return 'bili sub getUserInfo()
|
|
363
|
+
return 'bili sub getUserInfo() 发生了错误,错误为:' + e.toString();
|
|
364
364
|
}
|
|
365
365
|
// 判断是否有其他问题
|
|
366
366
|
if (content.code !== 0) {
|
|
@@ -378,7 +378,9 @@ class ComRegister {
|
|
|
378
378
|
case -352:
|
|
379
379
|
msg = '请登录后再尝试订阅';
|
|
380
380
|
break;
|
|
381
|
-
default:
|
|
381
|
+
default:
|
|
382
|
+
msg = '未知错误,错误信息:' + content.message;
|
|
383
|
+
break;
|
|
382
384
|
}
|
|
383
385
|
return msg;
|
|
384
386
|
}
|
|
@@ -495,7 +497,7 @@ class ComRegister {
|
|
|
495
497
|
userData = data;
|
|
496
498
|
}
|
|
497
499
|
catch (e) {
|
|
498
|
-
this.logger.error('bili sub指令 getMasterInfo()
|
|
500
|
+
this.logger.error('bili sub指令 getMasterInfo() 发生了错误,错误为:' + e.toString());
|
|
499
501
|
return '订阅出错啦,请重试';
|
|
500
502
|
}
|
|
501
503
|
// 需要订阅直播
|
|
@@ -571,7 +573,7 @@ class ComRegister {
|
|
|
571
573
|
content = await ctx.biliAPI.getLiveRoomInfo(roomId);
|
|
572
574
|
}
|
|
573
575
|
catch (e) {
|
|
574
|
-
return 'bili status指令 getLiveRoomInfo()
|
|
576
|
+
return 'bili status指令 getLiveRoomInfo() 发生了错误,错误为:' + e.toString();
|
|
575
577
|
}
|
|
576
578
|
const { data } = content;
|
|
577
579
|
let userData;
|
|
@@ -580,7 +582,7 @@ class ComRegister {
|
|
|
580
582
|
userData = userInfo;
|
|
581
583
|
}
|
|
582
584
|
catch (e) {
|
|
583
|
-
return 'bili status指令 getMasterInfo()
|
|
585
|
+
return 'bili status指令 getMasterInfo() 发生了错误,错误为:' + e.toString();
|
|
584
586
|
}
|
|
585
587
|
// B站出问题了
|
|
586
588
|
if (content.code !== 0) {
|
|
@@ -588,7 +590,7 @@ class ComRegister {
|
|
|
588
590
|
session.send('未找到该房间');
|
|
589
591
|
}
|
|
590
592
|
else {
|
|
591
|
-
session.send('
|
|
593
|
+
session.send('未知错误,错误信息为:' + content.message);
|
|
592
594
|
}
|
|
593
595
|
return;
|
|
594
596
|
}
|
|
@@ -626,42 +628,42 @@ class ComRegister {
|
|
|
626
628
|
// 发送提示
|
|
627
629
|
await session.send('已发送消息,如未收到则说明您的机器人不支持发送私聊消息或您的信息填写有误');
|
|
628
630
|
});
|
|
629
|
-
biliCom
|
|
631
|
+
/* biliCom
|
|
630
632
|
.subcommand('.reboot', '测试插件自动重启功能', { hidden: true })
|
|
631
633
|
.usage('测试插件自动重启功能')
|
|
632
634
|
.example('bili reboot 测试插件自动重启功能')
|
|
633
635
|
.action(async ({ session }) => {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
biliCom
|
|
636
|
+
// 发送提示消息
|
|
637
|
+
await session.send('测试biliAPI等服务自动重启功能')
|
|
638
|
+
// 获得对应bot
|
|
639
|
+
const bot = this.getTheCorrespondingBotBasedOnTheSession(session)
|
|
640
|
+
// 发送提示消息,重启服务
|
|
641
|
+
await this.sendPrivateMsgAndRebootService(ctx, bot, '测试biliAPI等服务自动重启功能')
|
|
642
|
+
}) */
|
|
643
|
+
/* biliCom
|
|
642
644
|
.subcommand('.sendall', '测试给机器人加入的所有群发送消息', { hidden: true })
|
|
643
645
|
.usage('测试给机器人加入的所有群发送消息')
|
|
644
646
|
.example('bili sendall 测试给机器人加入的所有群发送消息')
|
|
645
647
|
.action(async ({ session }) => {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
biliCom
|
|
648
|
+
// 获得对应bot
|
|
649
|
+
const bot = this.getTheCorrespondingBotBasedOnTheSession(session)
|
|
650
|
+
// 发送消息
|
|
651
|
+
await this.sendMsg(ctx, ['all'], bot, 'Hello World')
|
|
652
|
+
// 发送提示
|
|
653
|
+
await session.send('已向机器人加入的所有群发送了消息')
|
|
654
|
+
}) */
|
|
655
|
+
/* biliCom
|
|
654
656
|
.subcommand('.list', '获取机器人加入的所有群组', { hidden: true })
|
|
655
657
|
.usage('获取当前机器人加入的所有群聊')
|
|
656
658
|
.example('bili list 获取当前机器人加入的所有群聊')
|
|
657
659
|
.action(async ({ session }) => {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
660
|
+
// 获取对应Bot
|
|
661
|
+
const bot = this.getTheCorrespondingBotBasedOnTheSession(session)
|
|
662
|
+
// 获取群列表
|
|
663
|
+
const guildList = (await bot.getGuildList()).data
|
|
664
|
+
// 遍历群列表
|
|
665
|
+
guildList.map(item => this.logger.info(`已加入${item.id}`))
|
|
666
|
+
}) */
|
|
665
667
|
}
|
|
666
668
|
getTheCorrespondingBotBasedOnTheSession(session) {
|
|
667
669
|
// 获取对应Bot
|
|
@@ -738,6 +740,8 @@ class ComRegister {
|
|
|
738
740
|
await bot.sendMessage(guildId, content);
|
|
739
741
|
// 防止消息发送速度过快被忽略
|
|
740
742
|
await ctx.sleep(500);
|
|
743
|
+
// 成功发送消息,跳出循环
|
|
744
|
+
break;
|
|
741
745
|
}
|
|
742
746
|
catch (e) {
|
|
743
747
|
if (i === attempts - 1) { // 已尝试三次
|
|
@@ -765,7 +769,7 @@ class ComRegister {
|
|
|
765
769
|
content = await ctx.biliAPI.getUserSpaceDynamic(uid);
|
|
766
770
|
}
|
|
767
771
|
catch (e) {
|
|
768
|
-
return this.logger.error('dynamicDetect getUserSpaceDynamic()
|
|
772
|
+
return this.logger.error('dynamicDetect getUserSpaceDynamic() 发生了错误,错误为:' + e.toString());
|
|
769
773
|
}
|
|
770
774
|
// 判断是否出现其他问题
|
|
771
775
|
if (content.code !== 0) {
|
|
@@ -774,7 +778,7 @@ class ComRegister {
|
|
|
774
778
|
await this.sendPrivateMsg(bot, '账号未登录,请登录后重新订阅动态');
|
|
775
779
|
break;
|
|
776
780
|
}
|
|
777
|
-
default: await this.sendPrivateMsg(bot, '
|
|
781
|
+
default: await this.sendPrivateMsg(bot, '获取动态信息错误,错误为:' + content.message); // 未知错误
|
|
778
782
|
}
|
|
779
783
|
// 取消订阅
|
|
780
784
|
this.unsubSingle(ctx, uid, 1); /* 1为取消动态订阅 */
|
|
@@ -919,7 +923,7 @@ class ComRegister {
|
|
|
919
923
|
break;
|
|
920
924
|
}
|
|
921
925
|
catch (e) {
|
|
922
|
-
this.logger.error('liveDetect getLiveRoomInfo
|
|
926
|
+
this.logger.error('liveDetect getLiveRoomInfo 发生了错误,错误为:' + e.toString());
|
|
923
927
|
if (i === attempts - 1) { // 已尝试三次
|
|
924
928
|
return await this.sendPrivateMsgAndRebootService(ctx, bot, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
|
|
925
929
|
}
|
|
@@ -941,7 +945,7 @@ class ComRegister {
|
|
|
941
945
|
break;
|
|
942
946
|
}
|
|
943
947
|
catch (e) {
|
|
944
|
-
this.logger.error('liveDetect getMasterInfo()
|
|
948
|
+
this.logger.error('liveDetect getMasterInfo() 发生了错误,错误为:' + e.toString());
|
|
945
949
|
if (i === attempts - 1) { // 已尝试三次
|
|
946
950
|
return await this.sendPrivateMsgAndRebootService(ctx, bot, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
|
|
947
951
|
}
|
|
@@ -997,7 +1001,7 @@ class ComRegister {
|
|
|
997
1001
|
break;
|
|
998
1002
|
}
|
|
999
1003
|
catch (e) {
|
|
1000
|
-
this.logger.error('liveDetect open getMasterInfo()
|
|
1004
|
+
this.logger.error('liveDetect open getMasterInfo() 发生了错误,错误为:' + e.toString());
|
|
1001
1005
|
if (i === attempts - 1) { // 已尝试三次
|
|
1002
1006
|
return await this.sendPrivateMsgAndRebootService(ctx, bot, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
|
|
1003
1007
|
}
|
|
@@ -1204,7 +1208,7 @@ class ComRegister {
|
|
|
1204
1208
|
break;
|
|
1205
1209
|
}
|
|
1206
1210
|
catch (e) {
|
|
1207
|
-
this.logger.error('getSubFromDatabase() getUserInfo()
|
|
1211
|
+
this.logger.error('getSubFromDatabase() getUserInfo() 发生了错误,错误为:' + e.toString());
|
|
1208
1212
|
if (i === attempts - 1) { // 已尝试三次
|
|
1209
1213
|
return await this.sendPrivateMsgAndRebootService(ctx, bot, '你的网络可能出现了某些问题,请检查后重启插件');
|
|
1210
1214
|
}
|
package/lib/database.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.name = void 0;
|
|
4
|
-
exports.apply = apply;
|
|
3
|
+
exports.apply = exports.name = void 0;
|
|
5
4
|
exports.name = 'Database';
|
|
6
5
|
function apply(ctx) {
|
|
7
6
|
// 新增LoginBili表
|
|
@@ -23,3 +22,4 @@ function apply(ctx) {
|
|
|
23
22
|
time: 'timestamp'
|
|
24
23
|
}, { autoInc: true });
|
|
25
24
|
}
|
|
25
|
+
exports.apply = apply;
|
package/lib/index.js
CHANGED
|
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Config = exports.name = exports.inject = void 0;
|
|
30
|
-
exports.apply = apply;
|
|
29
|
+
exports.apply = exports.Config = exports.name = exports.inject = void 0;
|
|
31
30
|
const koishi_1 = require("koishi");
|
|
32
31
|
// import plugins
|
|
33
32
|
// import Authority from './authority'
|
|
@@ -244,3 +243,4 @@ function apply(ctx, config) {
|
|
|
244
243
|
}
|
|
245
244
|
});
|
|
246
245
|
}
|
|
246
|
+
exports.apply = apply;
|
package/package.json
CHANGED
package/readme.md
CHANGED