koishi-plugin-bilibili-notify 1.2.3-alpha.0 → 1.2.3-beta.0
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.d.ts +2 -2
- package/lib/comRegister.js +24 -20
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/lib/serverManager.d.ts +0 -0
- package/lib/serverManager.js +0 -0
package/lib/comRegister.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ declare class ComRegister {
|
|
|
26
26
|
satoriBot: Bot<Context>;
|
|
27
27
|
chronocatBot: Bot<Context>;
|
|
28
28
|
constructor(ctx: Context, config: ComRegister.Config);
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
sendPrivateMsg(bot: Bot<Context>, content: string): Promise<void>;
|
|
30
|
+
sendPrivateMsgAndRebootService(bot: Bot<Context>, ctx: Context, content: string): Promise<void>;
|
|
31
31
|
dynamicDetect(ctx: Context, bot: Bot<Context>, uid: string, guildId: Array<string>): () => Promise<void>;
|
|
32
32
|
sendMsg(targets: Array<string>, bot: Bot<Context>, content: any): Promise<void>;
|
|
33
33
|
liveDetect(ctx: Context, bot: Bot<Context>, roomId: string, guildId: Array<string>): () => Promise<void>;
|
package/lib/comRegister.js
CHANGED
|
@@ -652,8 +652,14 @@ class ComRegister {
|
|
|
652
652
|
this.logger.info('--------------------------------');
|
|
653
653
|
});
|
|
654
654
|
});
|
|
655
|
+
biliCom
|
|
656
|
+
.subcommand('.private', '向主人账号发送一条测试消息', { hidden: true })
|
|
657
|
+
.usage('向主人账号发送一条测试消息')
|
|
658
|
+
.example('bili private 向主人账号发送一条测试消息')
|
|
659
|
+
.action(() => {
|
|
660
|
+
});
|
|
655
661
|
}
|
|
656
|
-
async
|
|
662
|
+
async sendPrivateMsg(bot, content) {
|
|
657
663
|
if (this.config.master.enable) {
|
|
658
664
|
if (this.config.master.masterAccountGuildId) {
|
|
659
665
|
// 向机器人主人发送消息
|
|
@@ -664,12 +670,9 @@ class ComRegister {
|
|
|
664
670
|
await bot.sendPrivateMessage(this.config.master.masterAccount, content);
|
|
665
671
|
}
|
|
666
672
|
}
|
|
667
|
-
else {
|
|
668
|
-
await this.sendMsg(guildId, bot, content);
|
|
669
|
-
}
|
|
670
673
|
}
|
|
671
|
-
|
|
672
|
-
this.
|
|
674
|
+
async sendPrivateMsgAndRebootService(bot, ctx, content) {
|
|
675
|
+
await this.sendPrivateMsg(bot, content);
|
|
673
676
|
// 停用插件
|
|
674
677
|
ctx.sm.disposePlugin();
|
|
675
678
|
// 隔一秒启动插件
|
|
@@ -701,11 +704,10 @@ class ComRegister {
|
|
|
701
704
|
if (content.code !== 0) {
|
|
702
705
|
switch (content.code) {
|
|
703
706
|
case -101: { // 账号未登录
|
|
704
|
-
await this.
|
|
705
|
-
|
|
706
|
-
default: { // 未知错误
|
|
707
|
-
await this.sendMsg(guildId, bot, '未知错误,请重新订阅动态');
|
|
707
|
+
await this.sendPrivateMsg(bot, '账号未登录,请登录后重新订阅动态');
|
|
708
|
+
break;
|
|
708
709
|
}
|
|
710
|
+
default: await this.sendPrivateMsg(bot, '未知错误,请重新订阅动态'); // 未知错误
|
|
709
711
|
}
|
|
710
712
|
// 取消订阅
|
|
711
713
|
this.unsubSingle(ctx, uid, 1); /* 1为取消动态订阅 */
|
|
@@ -773,7 +775,7 @@ class ComRegister {
|
|
|
773
775
|
bot,
|
|
774
776
|
'插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈'
|
|
775
777
|
) */
|
|
776
|
-
this.
|
|
778
|
+
return await this.sendPrivateMsgAndRebootService(bot, ctx, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
|
|
777
779
|
}
|
|
778
780
|
}
|
|
779
781
|
}
|
|
@@ -844,7 +846,7 @@ class ComRegister {
|
|
|
844
846
|
bot,
|
|
845
847
|
'插件可能出现某些未知错误,已自动重启插件,如果仍然发生该错误,请带着日志向作者反馈'
|
|
846
848
|
) */
|
|
847
|
-
this.
|
|
849
|
+
return await this.sendPrivateMsgAndRebootService(bot, ctx, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
|
|
848
850
|
}
|
|
849
851
|
}
|
|
850
852
|
}
|
|
@@ -873,7 +875,7 @@ class ComRegister {
|
|
|
873
875
|
bot,
|
|
874
876
|
'你的网络可能出现了某些问题,请检查后重启插件',
|
|
875
877
|
) */
|
|
876
|
-
this.
|
|
878
|
+
return await this.sendPrivateMsgAndRebootService(bot, ctx, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
|
|
877
879
|
}
|
|
878
880
|
}
|
|
879
881
|
}
|
|
@@ -900,7 +902,7 @@ class ComRegister {
|
|
|
900
902
|
bot,
|
|
901
903
|
'你的网络可能出现了某些问题,请检查后重启插件',
|
|
902
904
|
) */
|
|
903
|
-
this.
|
|
905
|
+
return await this.sendPrivateMsgAndRebootService(bot, ctx, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
|
|
904
906
|
}
|
|
905
907
|
}
|
|
906
908
|
}
|
|
@@ -961,7 +963,7 @@ class ComRegister {
|
|
|
961
963
|
bot,
|
|
962
964
|
'你的网络可能出现了某些问题,请检查后重启插件',
|
|
963
965
|
) */
|
|
964
|
-
this.
|
|
966
|
+
return await this.sendPrivateMsgAndRebootService(bot, ctx, '插件可能出现某些未知错误,请尝试重启插件,如果仍然发生该错误,请带着日志向作者反馈');
|
|
965
967
|
}
|
|
966
968
|
}
|
|
967
969
|
}
|
|
@@ -1149,7 +1151,7 @@ class ComRegister {
|
|
|
1149
1151
|
// 不支持的协议
|
|
1150
1152
|
this.logger.info(`UID:${sub.uid} 出现不支持的协议,该条数据被篡改,自动取消订阅`);
|
|
1151
1153
|
// 发送消息
|
|
1152
|
-
await this.
|
|
1154
|
+
await this.sendPrivateMsg(bot, `UID:${sub.uid} 出现不支持的协议,该条数据被篡改,自动取消订阅`);
|
|
1153
1155
|
// 继续下个循环
|
|
1154
1156
|
continue;
|
|
1155
1157
|
}
|
|
@@ -1173,7 +1175,7 @@ class ComRegister {
|
|
|
1173
1175
|
bot,
|
|
1174
1176
|
'你的网络可能出现了某些问题,请检查后重启插件'
|
|
1175
1177
|
) */
|
|
1176
|
-
this.
|
|
1178
|
+
return await this.sendPrivateMsgAndRebootService(bot, ctx, '你的网络可能出现了某些问题,请检查后重启插件');
|
|
1177
1179
|
}
|
|
1178
1180
|
}
|
|
1179
1181
|
}
|
|
@@ -1184,7 +1186,7 @@ class ComRegister {
|
|
|
1184
1186
|
// 从数据库删除该条数据
|
|
1185
1187
|
await ctx.database.remove('bilibili', { id: sub.id });
|
|
1186
1188
|
// 给用户发送提示
|
|
1187
|
-
await this.
|
|
1189
|
+
await this.sendPrivateMsg(bot, `UID:${sub.uid} 数据库内容被篡改,已取消对该UP主的订阅`);
|
|
1188
1190
|
/* await this.sendMsg(
|
|
1189
1191
|
targetArr,
|
|
1190
1192
|
bot,
|
|
@@ -1196,7 +1198,7 @@ class ComRegister {
|
|
|
1196
1198
|
switch (content.code) {
|
|
1197
1199
|
case -352:
|
|
1198
1200
|
case -403: {
|
|
1199
|
-
await this.
|
|
1201
|
+
await this.sendPrivateMsg(bot, '你的登录信息已过期,请重新登录Bilibili');
|
|
1200
1202
|
/* this.sendMsg(
|
|
1201
1203
|
targetArr,
|
|
1202
1204
|
bot,
|
|
@@ -1208,6 +1210,8 @@ class ComRegister {
|
|
|
1208
1210
|
case -404:
|
|
1209
1211
|
default: {
|
|
1210
1212
|
await deleteSub();
|
|
1213
|
+
// PrivateMsg
|
|
1214
|
+
await this.sendPrivateMsg(bot, `UID:${sub.uid} 数据出现问题,自动取消订阅`);
|
|
1211
1215
|
// log
|
|
1212
1216
|
this.logger.info(`UID:${sub.uid} 数据出现问题,自动取消订阅`);
|
|
1213
1217
|
return;
|
|
@@ -1221,7 +1225,7 @@ class ComRegister {
|
|
|
1221
1225
|
// log
|
|
1222
1226
|
this.logger.info(`UID:${sub.uid} 房间号被篡改,自动取消订阅`);
|
|
1223
1227
|
// Send msg
|
|
1224
|
-
await this.
|
|
1228
|
+
await this.sendPrivateMsg(bot, `UID:${sub.uid} 房间号被篡改,自动取消订阅`);
|
|
1225
1229
|
return;
|
|
1226
1230
|
}
|
|
1227
1231
|
// 构建订阅对象
|
package/lib/index.js
CHANGED
|
@@ -51,7 +51,7 @@ exports.Config = koishi_1.Schema.object({
|
|
|
51
51
|
koishi_1.Schema.object({
|
|
52
52
|
enable: koishi_1.Schema.boolean()
|
|
53
53
|
.default(false)
|
|
54
|
-
.description('
|
|
54
|
+
.description('是否开启主人账号功能,如果您的机器人没有私聊权限请不要开启此功能。开启后如果机器人运行错误会向您进行报告')
|
|
55
55
|
.experimental()
|
|
56
56
|
}).description('主人账号'),
|
|
57
57
|
koishi_1.Schema.union([
|
package/package.json
CHANGED
package/lib/serverManager.d.ts
DELETED
|
File without changes
|
package/lib/serverManager.js
DELETED
|
File without changes
|