koishi-plugin-bilibili-notify 3.3.2 → 3.3.3
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/index.js +21 -15
- package/lib/index.mjs +21 -15
- package/package.json +5 -5
- package/readme.md +1 -0
package/lib/index.js
CHANGED
|
@@ -665,11 +665,13 @@ var ComRegister = class {
|
|
|
665
665
|
}
|
|
666
666
|
this.mergeStopWords(config.wordcloudStopWords);
|
|
667
667
|
this.registeringForEvents();
|
|
668
|
-
if (config.advancedSub)
|
|
669
|
-
|
|
668
|
+
if (config.advancedSub) {
|
|
669
|
+
this.logger.info("开启高级订阅,等待加载订阅...");
|
|
670
|
+
this.ctx.emit("bilibili-notify/ready-to-recive");
|
|
671
|
+
} else if (config.subs && config.subs.length > 0) {
|
|
670
672
|
const subs = this.configSubsToSubscription(config.subs);
|
|
671
673
|
await this.initAsyncPart(subs);
|
|
672
|
-
}
|
|
674
|
+
} else this.logger.info("初始化完毕,未添加任何订阅!");
|
|
673
675
|
}
|
|
674
676
|
registeringForEvents() {
|
|
675
677
|
this.ctx.on("dispose", () => {
|
|
@@ -682,6 +684,10 @@ var ComRegister = class {
|
|
|
682
684
|
}
|
|
683
685
|
});
|
|
684
686
|
this.ctx.on("bilibili-notify/advanced-sub", async (subs) => {
|
|
687
|
+
if (Object.keys(subs).length === 0) {
|
|
688
|
+
this.logger.info("初始化完毕,未添加任何订阅!");
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
685
691
|
if (this.reciveSubTimes >= 1) await this.ctx["bilibili-notify"].restartPlugin();
|
|
686
692
|
else await this.initAsyncPart(subs);
|
|
687
693
|
this.reciveSubTimes++;
|
|
@@ -689,6 +695,7 @@ var ComRegister = class {
|
|
|
689
695
|
}
|
|
690
696
|
async initAsyncPart(subs) {
|
|
691
697
|
this.initAllManager();
|
|
698
|
+
this.logger.info("获取到订阅信息,开始加载订阅...");
|
|
692
699
|
const { code, message } = await this.loadSubFromConfig(subs);
|
|
693
700
|
if (code !== 0) {
|
|
694
701
|
this.logger.error(message);
|
|
@@ -1522,19 +1529,18 @@ var ComRegister = class {
|
|
|
1522
1529
|
}
|
|
1523
1530
|
async subUserInBili(mid) {
|
|
1524
1531
|
const checkGroupIsReady = async () => {
|
|
1525
|
-
|
|
1532
|
+
const allGroupData = await this.ctx["bilibili-notify-api"].getAllGroup();
|
|
1533
|
+
let existFlag = false;
|
|
1534
|
+
for (const group of allGroupData.data) if (group.name === "订阅") {
|
|
1535
|
+
if (this.loginDBData.dynamic_group_id !== group.tagid.toString()) {
|
|
1536
|
+
this.loginDBData.dynamic_group_id = group.tagid.toString();
|
|
1537
|
+
this.ctx.database.set("loginBili", 1, { dynamic_group_id: this.loginDBData.dynamic_group_id });
|
|
1538
|
+
}
|
|
1539
|
+
existFlag = true;
|
|
1540
|
+
}
|
|
1541
|
+
if (!existFlag) {
|
|
1526
1542
|
const createGroupData = await this.ctx["bilibili-notify-api"].createGroup("订阅");
|
|
1527
|
-
if (createGroupData.code
|
|
1528
|
-
const allGroupData = await this.ctx["bilibili-notify-api"].getAllGroup();
|
|
1529
|
-
for (const group of allGroupData.data) if (group.name === "订阅") {
|
|
1530
|
-
this.loginDBData.dynamic_group_id = group.tagid.toString();
|
|
1531
|
-
this.ctx.database.set("loginBili", 1, { dynamic_group_id: this.loginDBData.dynamic_group_id });
|
|
1532
|
-
return {
|
|
1533
|
-
code: 0,
|
|
1534
|
-
message: "分组已存在"
|
|
1535
|
-
};
|
|
1536
|
-
}
|
|
1537
|
-
} else if (createGroupData.code !== 0) return {
|
|
1543
|
+
if (createGroupData.code !== 0) return {
|
|
1538
1544
|
code: createGroupData.code,
|
|
1539
1545
|
message: createGroupData.message
|
|
1540
1546
|
};
|
package/lib/index.mjs
CHANGED
|
@@ -646,11 +646,13 @@ var ComRegister = class {
|
|
|
646
646
|
}
|
|
647
647
|
this.mergeStopWords(config.wordcloudStopWords);
|
|
648
648
|
this.registeringForEvents();
|
|
649
|
-
if (config.advancedSub)
|
|
650
|
-
|
|
649
|
+
if (config.advancedSub) {
|
|
650
|
+
this.logger.info("开启高级订阅,等待加载订阅...");
|
|
651
|
+
this.ctx.emit("bilibili-notify/ready-to-recive");
|
|
652
|
+
} else if (config.subs && config.subs.length > 0) {
|
|
651
653
|
const subs = this.configSubsToSubscription(config.subs);
|
|
652
654
|
await this.initAsyncPart(subs);
|
|
653
|
-
}
|
|
655
|
+
} else this.logger.info("初始化完毕,未添加任何订阅!");
|
|
654
656
|
}
|
|
655
657
|
registeringForEvents() {
|
|
656
658
|
this.ctx.on("dispose", () => {
|
|
@@ -663,6 +665,10 @@ var ComRegister = class {
|
|
|
663
665
|
}
|
|
664
666
|
});
|
|
665
667
|
this.ctx.on("bilibili-notify/advanced-sub", async (subs) => {
|
|
668
|
+
if (Object.keys(subs).length === 0) {
|
|
669
|
+
this.logger.info("初始化完毕,未添加任何订阅!");
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
666
672
|
if (this.reciveSubTimes >= 1) await this.ctx["bilibili-notify"].restartPlugin();
|
|
667
673
|
else await this.initAsyncPart(subs);
|
|
668
674
|
this.reciveSubTimes++;
|
|
@@ -670,6 +676,7 @@ var ComRegister = class {
|
|
|
670
676
|
}
|
|
671
677
|
async initAsyncPart(subs) {
|
|
672
678
|
this.initAllManager();
|
|
679
|
+
this.logger.info("获取到订阅信息,开始加载订阅...");
|
|
673
680
|
const { code, message } = await this.loadSubFromConfig(subs);
|
|
674
681
|
if (code !== 0) {
|
|
675
682
|
this.logger.error(message);
|
|
@@ -1503,19 +1510,18 @@ var ComRegister = class {
|
|
|
1503
1510
|
}
|
|
1504
1511
|
async subUserInBili(mid) {
|
|
1505
1512
|
const checkGroupIsReady = async () => {
|
|
1506
|
-
|
|
1513
|
+
const allGroupData = await this.ctx["bilibili-notify-api"].getAllGroup();
|
|
1514
|
+
let existFlag = false;
|
|
1515
|
+
for (const group of allGroupData.data) if (group.name === "订阅") {
|
|
1516
|
+
if (this.loginDBData.dynamic_group_id !== group.tagid.toString()) {
|
|
1517
|
+
this.loginDBData.dynamic_group_id = group.tagid.toString();
|
|
1518
|
+
this.ctx.database.set("loginBili", 1, { dynamic_group_id: this.loginDBData.dynamic_group_id });
|
|
1519
|
+
}
|
|
1520
|
+
existFlag = true;
|
|
1521
|
+
}
|
|
1522
|
+
if (!existFlag) {
|
|
1507
1523
|
const createGroupData = await this.ctx["bilibili-notify-api"].createGroup("订阅");
|
|
1508
|
-
if (createGroupData.code
|
|
1509
|
-
const allGroupData = await this.ctx["bilibili-notify-api"].getAllGroup();
|
|
1510
|
-
for (const group of allGroupData.data) if (group.name === "订阅") {
|
|
1511
|
-
this.loginDBData.dynamic_group_id = group.tagid.toString();
|
|
1512
|
-
this.ctx.database.set("loginBili", 1, { dynamic_group_id: this.loginDBData.dynamic_group_id });
|
|
1513
|
-
return {
|
|
1514
|
-
code: 0,
|
|
1515
|
-
message: "分组已存在"
|
|
1516
|
-
};
|
|
1517
|
-
}
|
|
1518
|
-
} else if (createGroupData.code !== 0) return {
|
|
1524
|
+
if (createGroupData.code !== 0) return {
|
|
1519
1525
|
code: createGroupData.code,
|
|
1520
1526
|
message: createGroupData.message
|
|
1521
1527
|
};
|
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.3.
|
|
4
|
+
"version": "3.3.3",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@akokko/blive-message-listener": "^0.5.1",
|
|
32
32
|
"@node-rs/jieba": "^2.0.1",
|
|
33
|
-
"axios": "^1.
|
|
34
|
-
"axios-cookiejar-support": "^6.0.
|
|
33
|
+
"axios": "^1.11.0",
|
|
34
|
+
"axios-cookiejar-support": "^6.0.4",
|
|
35
35
|
"cacheable-lookup": "^7.0.0",
|
|
36
|
-
"cron": "^4.3.
|
|
36
|
+
"cron": "^4.3.2",
|
|
37
37
|
"jsdom": "^26.1.0",
|
|
38
38
|
"luxon": "^3.7.1",
|
|
39
39
|
"md5": "^2.3.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/qrcode": "^1.5.5",
|
|
49
49
|
"@types/tough-cookie": "^4.0.5",
|
|
50
50
|
"koishi-plugin-puppeteer": "^3.9.0",
|
|
51
|
-
"tsdown": "^0.
|
|
51
|
+
"tsdown": "^0.13.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"koishi": "^4.18.8"
|
package/readme.md
CHANGED
|
@@ -333,6 +333,7 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
|
|
|
333
333
|
> - ver 3.3.1-rc.3 修复:当订阅用户没有直播且勾选订阅直播间报错;
|
|
334
334
|
> - ver 3.3.1 优化:如果不订阅UP主直播且未填写房间号不再请求用户接口;
|
|
335
335
|
> - ver 3.3.2 修复:当插件因动态报错停止后,应使用指令 `bn start` 启动插件,而不是 `bn restart`;
|
|
336
|
+
> - ver 3.3.3 优化:初始化logger输出; 修复:B站订阅操作bug;
|
|
336
337
|
|
|
337
338
|
## 交流群
|
|
338
339
|
|