koishi-plugin-bilibili-notify 3.5.0-alpha.0 → 3.5.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/index.cjs +53 -32
- package/lib/index.d.cts +7 -4
- package/lib/index.d.mts +7 -4
- package/lib/index.mjs +53 -32
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ openai = __toESM(openai);
|
|
|
70
70
|
const BAConfigSchema = koishi.Schema.object({
|
|
71
71
|
require: koishi.Schema.object({}).description("必填设置"),
|
|
72
72
|
key: koishi.Schema.string().pattern(/^[0-9a-f]{32}$/).role("secret").required().description("请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/"),
|
|
73
|
-
master: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("
|
|
73
|
+
master: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启主人账号功能,开启后如果机器人运行错误会向您进行报告。如果您的机器人没有私聊权限请不要开启此功能") }).description("主人账号"), koishi.Schema.union([koishi.Schema.object({
|
|
74
74
|
enable: koishi.Schema.const(true).required(),
|
|
75
75
|
platform: koishi.Schema.union([
|
|
76
76
|
"qq",
|
|
@@ -98,19 +98,19 @@ const BAConfigSchema = koishi.Schema.object({
|
|
|
98
98
|
subTitle: koishi.Schema.object({}).description("订阅配置"),
|
|
99
99
|
advancedSub: koishi.Schema.boolean().default(false).description("是否开启高级订阅,高级订阅是独立于本插件的一个专门用于订阅配置的插件,用于高度自定义订阅消息。若开启高级订阅,请打开该选项并下载插件 bilibili-notify-advanced-subscription"),
|
|
100
100
|
subs: koishi.Schema.array(koishi.Schema.object({
|
|
101
|
-
name: koishi.Schema.string().required().description("
|
|
101
|
+
name: koishi.Schema.string().required().description("UP昵称"),
|
|
102
102
|
uid: koishi.Schema.string().required().description("UID和roomid"),
|
|
103
103
|
dynamic: koishi.Schema.boolean().default(true).description("动态"),
|
|
104
|
-
dynamicAtAll: koishi.Schema.boolean().default(false).description("
|
|
104
|
+
dynamicAtAll: koishi.Schema.boolean().default(false).description("动态@全体"),
|
|
105
105
|
live: koishi.Schema.boolean().default(true).description("直播"),
|
|
106
|
-
liveAtAll: koishi.Schema.boolean().default(true).description("
|
|
106
|
+
liveAtAll: koishi.Schema.boolean().default(true).description("直播@全体"),
|
|
107
107
|
liveGuardBuy: koishi.Schema.boolean().default(false).description("上舰消息"),
|
|
108
108
|
superchat: koishi.Schema.boolean().default(false).description("SC消息"),
|
|
109
109
|
wordcloud: koishi.Schema.boolean().default(true).description("弹幕词云"),
|
|
110
110
|
liveSummary: koishi.Schema.boolean().default(true).description("直播总结"),
|
|
111
111
|
platform: koishi.Schema.string().required().description("平台名"),
|
|
112
112
|
target: koishi.Schema.string().required().description("群号/频道号")
|
|
113
|
-
})).role("table").description("
|
|
113
|
+
})).role("table").description("请在这里填写订阅信息;UP昵称是必填项,影响通知时显示的UP主昵称;UID和roomid,请填写订阅用户的UID,如果经常在初始化插件遇到风控问题,请补充直播间房间号,使用英文逗号分隔例如:1234567,114514;平台名,请填写adapter-xxxx中的xxxx,例如你的机器人使用的是adapter-onebot就填写onebot;群号/频道号,直接填写即可,如果有多个群聊或频道请使用英文逗号分隔,例如:1234567,2345678"),
|
|
114
114
|
dynamic: koishi.Schema.object({}).description("动态推送设置"),
|
|
115
115
|
dynamicUrl: koishi.Schema.boolean().default(false).description("发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!"),
|
|
116
116
|
dynamicCron: koishi.Schema.string().default("*/2 * * * *").description("动态监测时间,请填入cron表达式,请勿填入过短时间"),
|
|
@@ -130,8 +130,9 @@ const BAConfigSchema = koishi.Schema.object({
|
|
|
130
130
|
"🎖️ 特别嘉奖:-un4 & -un5",
|
|
131
131
|
"你们的弹幕,我们都记录在案!🕵️♀️"
|
|
132
132
|
]).role("table").description("自定义直播总结语,开启弹幕词云自动发送。变量解释:-dmc代表总弹幕发送人数,-mdn代表主播粉丝牌子名,-dca代表总弹幕数,-un1到-un5代表弹幕发送条数前五名用户的用户名,-dc1到-dc5代表弹幕发送条数前五名的弹幕发送数量,数组每一行代表换行"),
|
|
133
|
-
|
|
133
|
+
customGuardBuy: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启自定义上舰消息功能").experimental() }), koishi.Schema.union([koishi.Schema.object({
|
|
134
134
|
enable: koishi.Schema.const(true).required(),
|
|
135
|
+
guardBuyMsg: koishi.Schema.string().default("【-mname的直播间】-uname加入了大航海(-guard)").description("自定义上舰消息,-uname代表用户昵称,-muname代表主播昵称,-guard代表舰长类型"),
|
|
135
136
|
captainImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/captain-Bjw5Byb5.png").description("舰长图片链接"),
|
|
136
137
|
supervisorImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/supervisor-u43ElIjU.png").description("提督图片链接"),
|
|
137
138
|
governorImgUrl: koishi.Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/governor-DpDXKEdA.png").description("总督图片链接")
|
|
@@ -865,11 +866,12 @@ var ComRegister = class ComRegister {
|
|
|
865
866
|
roomid,
|
|
866
867
|
dynamic: s.dynamic,
|
|
867
868
|
live: s.live,
|
|
869
|
+
liveEnd: true,
|
|
868
870
|
target,
|
|
869
871
|
customCardStyle: { enable: false },
|
|
870
872
|
customLiveMsg: { enable: false },
|
|
871
873
|
customLiveSummary: { enable: false },
|
|
872
|
-
|
|
874
|
+
customGuardBuy: { enable: false }
|
|
873
875
|
};
|
|
874
876
|
});
|
|
875
877
|
return subs;
|
|
@@ -933,15 +935,17 @@ var ComRegister = class ComRegister {
|
|
|
933
935
|
sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
934
936
|
sub.customLiveMsg.customLive = this.config.customLive;
|
|
935
937
|
}
|
|
936
|
-
if (sub.
|
|
937
|
-
if (!sub.
|
|
938
|
-
if (!sub.
|
|
939
|
-
if (!sub.
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
sub.
|
|
943
|
-
sub.
|
|
944
|
-
sub.
|
|
938
|
+
if (sub.customGuardBuy.enable) {
|
|
939
|
+
if (!sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
940
|
+
if (!sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
941
|
+
if (!sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
942
|
+
if (!sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
943
|
+
} else if (this.config.customGuardBuy.enable) {
|
|
944
|
+
sub.customGuardBuy.enable = true;
|
|
945
|
+
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
946
|
+
sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
947
|
+
sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
948
|
+
sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
945
949
|
}
|
|
946
950
|
if (sub.customLiveSummary.enable) {
|
|
947
951
|
if (!sub.customLiveSummary.liveSummary.trim()) sub.customLiveSummary.liveSummary = this.config.liveSummary.join("\n");
|
|
@@ -1489,13 +1493,14 @@ var ComRegister = class ComRegister {
|
|
|
1489
1493
|
},
|
|
1490
1494
|
onGuardBuy: async ({ body }) => {
|
|
1491
1495
|
const msg = await (async () => {
|
|
1492
|
-
if (sub.
|
|
1496
|
+
if (sub.customGuardBuy.enable) {
|
|
1493
1497
|
const guardImg = {
|
|
1494
|
-
[blive_message_listener.GuardLevel.Jianzhang]: sub.
|
|
1495
|
-
[blive_message_listener.GuardLevel.Tidu]: sub.
|
|
1496
|
-
[blive_message_listener.GuardLevel.Zongdu]: sub.
|
|
1498
|
+
[blive_message_listener.GuardLevel.Jianzhang]: sub.customGuardBuy.captainImgUrl,
|
|
1499
|
+
[blive_message_listener.GuardLevel.Tidu]: sub.customGuardBuy.supervisorImgUrl,
|
|
1500
|
+
[blive_message_listener.GuardLevel.Zongdu]: sub.customGuardBuy.governorImgUrl
|
|
1497
1501
|
};
|
|
1498
|
-
|
|
1502
|
+
const msg$1 = sub.customGuardBuy.guardBuyMsg.replace("-uname", body.user.uname).replace("-mname", masterInfo.username).replace("-guard", body.gift_name);
|
|
1503
|
+
return (0, koishi.h)("message", [koishi.h.image(guardImg[body.guard_level]), koishi.h.text(msg$1)]);
|
|
1499
1504
|
} else {
|
|
1500
1505
|
const guardImg = ComRegister.GUARD_LEVEL_IMG[body.guard_level];
|
|
1501
1506
|
const data = await this.ctx["bilibili-notify-api"].getUserInfoInLive(body.user.uid.toString(), sub.uid);
|
|
@@ -1578,17 +1583,19 @@ var ComRegister = class ComRegister {
|
|
|
1578
1583
|
})();
|
|
1579
1584
|
liveData.fansChanged = followerChange;
|
|
1580
1585
|
const liveEndMsg = sub.customLiveMsg.customLiveEnd.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
+
if (sub.liveEnd) {
|
|
1587
|
+
await this.sendLiveNotifyCard(LiveType.StopBroadcast, liveData, {
|
|
1588
|
+
liveRoomInfo,
|
|
1589
|
+
masterInfo,
|
|
1590
|
+
cardStyle: sub.customCardStyle
|
|
1591
|
+
}, sub.uid, liveEndMsg);
|
|
1592
|
+
await sendDanmakuWordCloudAndLiveSummary(sub.customLiveSummary.liveSummary);
|
|
1593
|
+
}
|
|
1586
1594
|
if (pushAtTimeTimer) {
|
|
1587
1595
|
pushAtTimeTimer();
|
|
1588
1596
|
pushAtTimeTimer = null;
|
|
1589
1597
|
this.liveWSManager.delete(sub.roomid);
|
|
1590
1598
|
}
|
|
1591
|
-
await sendDanmakuWordCloudAndLiveSummary(sub.customLiveSummary.liveSummary);
|
|
1592
1599
|
}
|
|
1593
1600
|
});
|
|
1594
1601
|
if (!await useLiveRoomInfo(LiveType.FirstLiveBroadcast) && !await useMasterInfo(LiveType.FirstLiveBroadcast)) return this.sendPrivateMsg("获取直播间信息失败,启动直播间弹幕检测失败!");
|
|
@@ -1905,11 +1912,12 @@ var ComRegister = class ComRegister {
|
|
|
1905
1912
|
model: koishi.Schema.string().default("gpt-3.5-turbo"),
|
|
1906
1913
|
persona: koishi.Schema.string()
|
|
1907
1914
|
}),
|
|
1908
|
-
|
|
1915
|
+
customGuardBuy: koishi.Schema.object({
|
|
1909
1916
|
enable: koishi.Schema.boolean().default(false).description("是否启用自定义舰长购买图片"),
|
|
1910
1917
|
captainImgUrl: koishi.Schema.string().description("舰长图片链接"),
|
|
1911
1918
|
supervisorImgUrl: koishi.Schema.string().description("提督图片链接"),
|
|
1912
|
-
governorImgUrl: koishi.Schema.string().description("总督图片链接")
|
|
1919
|
+
governorImgUrl: koishi.Schema.string().description("总督图片链接"),
|
|
1920
|
+
guardBuyMsg: koishi.Schema.string().description("舰长购买消息")
|
|
1913
1921
|
})
|
|
1914
1922
|
});
|
|
1915
1923
|
})(ComRegister || (ComRegister = {}));
|
|
@@ -4452,8 +4460,21 @@ const inject = [
|
|
|
4452
4460
|
];
|
|
4453
4461
|
const name = "bilibili-notify";
|
|
4454
4462
|
const usage = `
|
|
4455
|
-
|
|
4456
|
-
|
|
4463
|
+
<h1>Bilibili-Notify</h1>
|
|
4464
|
+
<p>使用问题请加群咨询 801338523</p>
|
|
4465
|
+
|
|
4466
|
+
---
|
|
4467
|
+
|
|
4468
|
+
使用说明:
|
|
4469
|
+
- 请仔细阅读subs的配置说明,并在订阅配置中填写正确的 UID 和订阅类型
|
|
4470
|
+
- 订阅类型包括:动态、直播等
|
|
4471
|
+
|
|
4472
|
+
注意事项:
|
|
4473
|
+
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4474
|
+
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4475
|
+
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4476
|
+
|
|
4477
|
+
---
|
|
4457
4478
|
`;
|
|
4458
4479
|
let globalConfig;
|
|
4459
4480
|
var ServerManager = class extends koishi.Service {
|
|
@@ -4512,7 +4533,7 @@ var ServerManager = class extends koishi.Service {
|
|
|
4512
4533
|
customLiveStart: globalConfig.customLiveStart,
|
|
4513
4534
|
customLive: globalConfig.customLive,
|
|
4514
4535
|
customLiveEnd: globalConfig.customLiveEnd,
|
|
4515
|
-
customGuardBuyImg: globalConfig.
|
|
4536
|
+
customGuardBuyImg: globalConfig.customGuardBuy,
|
|
4516
4537
|
dynamicUrl: globalConfig.dynamicUrl,
|
|
4517
4538
|
dynamicCron: globalConfig.dynamicCron,
|
|
4518
4539
|
dynamicVideoUrlToBV: globalConfig.dynamicVideoUrlToBV,
|
package/lib/index.d.cts
CHANGED
|
@@ -38,8 +38,9 @@ interface BAConfig {
|
|
|
38
38
|
live: {};
|
|
39
39
|
wordcloudStopWords: string;
|
|
40
40
|
liveSummary: Array<string>;
|
|
41
|
-
|
|
41
|
+
customGuardBuy: {
|
|
42
42
|
enable: boolean;
|
|
43
|
+
guardBuyMsg?: string;
|
|
43
44
|
captainImgUrl?: string;
|
|
44
45
|
supervisorImgUrl?: string;
|
|
45
46
|
governorImgUrl?: string;
|
|
@@ -95,8 +96,9 @@ type CustomLiveMsg = {
|
|
|
95
96
|
customLive?: string;
|
|
96
97
|
customLiveEnd?: string;
|
|
97
98
|
};
|
|
98
|
-
type
|
|
99
|
+
type CustomGuardBuy = {
|
|
99
100
|
enable: boolean;
|
|
101
|
+
guardBuyMsg?: string;
|
|
100
102
|
captainImgUrl?: string;
|
|
101
103
|
supervisorImgUrl?: string;
|
|
102
104
|
governorImgUrl?: string;
|
|
@@ -111,18 +113,19 @@ type Subscription = {
|
|
|
111
113
|
roomid: string;
|
|
112
114
|
dynamic: boolean;
|
|
113
115
|
live: boolean;
|
|
116
|
+
liveEnd: boolean;
|
|
114
117
|
target: Target;
|
|
115
118
|
customCardStyle: CustomCardStyle;
|
|
116
119
|
customLiveMsg: CustomLiveMsg;
|
|
117
120
|
customLiveSummary: CustomLiveSummary;
|
|
118
|
-
|
|
121
|
+
customGuardBuy: CustomGuardBuy;
|
|
119
122
|
};
|
|
120
123
|
type Subscriptions = Record<string, Subscription>;
|
|
121
124
|
//#endregion
|
|
122
125
|
//#region src/index.d.ts
|
|
123
126
|
declare const inject: string[];
|
|
124
127
|
declare const name = "bilibili-notify";
|
|
125
|
-
declare const usage = "\n
|
|
128
|
+
declare const usage = "\n<h1>Bilibili-Notify</h1>\n<p>\u4F7F\u7528\u95EE\u9898\u8BF7\u52A0\u7FA4\u54A8\u8BE2 801338523</p>\n\n---\n\n\u4F7F\u7528\u8BF4\u660E\uFF1A\n- \u8BF7\u4ED4\u7EC6\u9605\u8BFBsubs\u7684\u914D\u7F6E\u8BF4\u660E\uFF0C\u5E76\u5728\u8BA2\u9605\u914D\u7F6E\u4E2D\u586B\u5199\u6B63\u786E\u7684 UID \u548C\u8BA2\u9605\u7C7B\u578B\n- \u8BA2\u9605\u7C7B\u578B\u5305\u62EC\uFF1A\u52A8\u6001\u3001\u76F4\u64AD\u7B49\n\n\u6CE8\u610F\u4E8B\u9879\uFF1A\n- \u5982\u679C\u4F60\u4F7F\u7528\u7684\u662F onebot \u673A\u5668\u4EBA\uFF0C\u5E73\u53F0\u540D\u8BF7\u586B\u5199 onebot \u800C\u4E0D\u662F qq\n- \u5982\u679C\u4F60\u4F7F\u7528\u7684\u662F onebot \u673A\u5668\u4EBA\uFF0C\u5E73\u53F0\u540D\u8BF7\u586B\u5199 onebot \u800C\u4E0D\u662F qq\n- \u5982\u679C\u4F60\u4F7F\u7528\u7684\u662F onebot \u673A\u5668\u4EBA\uFF0C\u5E73\u53F0\u540D\u8BF7\u586B\u5199 onebot \u800C\u4E0D\u662F qq\n\n---\n";
|
|
126
129
|
declare module "koishi" {
|
|
127
130
|
interface Context {
|
|
128
131
|
"bilibili-notify": ServerManager;
|
package/lib/index.d.mts
CHANGED
|
@@ -38,8 +38,9 @@ interface BAConfig {
|
|
|
38
38
|
live: {};
|
|
39
39
|
wordcloudStopWords: string;
|
|
40
40
|
liveSummary: Array<string>;
|
|
41
|
-
|
|
41
|
+
customGuardBuy: {
|
|
42
42
|
enable: boolean;
|
|
43
|
+
guardBuyMsg?: string;
|
|
43
44
|
captainImgUrl?: string;
|
|
44
45
|
supervisorImgUrl?: string;
|
|
45
46
|
governorImgUrl?: string;
|
|
@@ -95,8 +96,9 @@ type CustomLiveMsg = {
|
|
|
95
96
|
customLive?: string;
|
|
96
97
|
customLiveEnd?: string;
|
|
97
98
|
};
|
|
98
|
-
type
|
|
99
|
+
type CustomGuardBuy = {
|
|
99
100
|
enable: boolean;
|
|
101
|
+
guardBuyMsg?: string;
|
|
100
102
|
captainImgUrl?: string;
|
|
101
103
|
supervisorImgUrl?: string;
|
|
102
104
|
governorImgUrl?: string;
|
|
@@ -111,18 +113,19 @@ type Subscription = {
|
|
|
111
113
|
roomid: string;
|
|
112
114
|
dynamic: boolean;
|
|
113
115
|
live: boolean;
|
|
116
|
+
liveEnd: boolean;
|
|
114
117
|
target: Target;
|
|
115
118
|
customCardStyle: CustomCardStyle;
|
|
116
119
|
customLiveMsg: CustomLiveMsg;
|
|
117
120
|
customLiveSummary: CustomLiveSummary;
|
|
118
|
-
|
|
121
|
+
customGuardBuy: CustomGuardBuy;
|
|
119
122
|
};
|
|
120
123
|
type Subscriptions = Record<string, Subscription>;
|
|
121
124
|
//#endregion
|
|
122
125
|
//#region src/index.d.ts
|
|
123
126
|
declare const inject: string[];
|
|
124
127
|
declare const name = "bilibili-notify";
|
|
125
|
-
declare const usage = "\n
|
|
128
|
+
declare const usage = "\n<h1>Bilibili-Notify</h1>\n<p>\u4F7F\u7528\u95EE\u9898\u8BF7\u52A0\u7FA4\u54A8\u8BE2 801338523</p>\n\n---\n\n\u4F7F\u7528\u8BF4\u660E\uFF1A\n- \u8BF7\u4ED4\u7EC6\u9605\u8BFBsubs\u7684\u914D\u7F6E\u8BF4\u660E\uFF0C\u5E76\u5728\u8BA2\u9605\u914D\u7F6E\u4E2D\u586B\u5199\u6B63\u786E\u7684 UID \u548C\u8BA2\u9605\u7C7B\u578B\n- \u8BA2\u9605\u7C7B\u578B\u5305\u62EC\uFF1A\u52A8\u6001\u3001\u76F4\u64AD\u7B49\n\n\u6CE8\u610F\u4E8B\u9879\uFF1A\n- \u5982\u679C\u4F60\u4F7F\u7528\u7684\u662F onebot \u673A\u5668\u4EBA\uFF0C\u5E73\u53F0\u540D\u8BF7\u586B\u5199 onebot \u800C\u4E0D\u662F qq\n- \u5982\u679C\u4F60\u4F7F\u7528\u7684\u662F onebot \u673A\u5668\u4EBA\uFF0C\u5E73\u53F0\u540D\u8BF7\u586B\u5199 onebot \u800C\u4E0D\u662F qq\n- \u5982\u679C\u4F60\u4F7F\u7528\u7684\u662F onebot \u673A\u5668\u4EBA\uFF0C\u5E73\u53F0\u540D\u8BF7\u586B\u5199 onebot \u800C\u4E0D\u662F qq\n\n---\n";
|
|
126
129
|
declare module "koishi" {
|
|
127
130
|
interface Context {
|
|
128
131
|
"bilibili-notify": ServerManager;
|
package/lib/index.mjs
CHANGED
|
@@ -41,7 +41,7 @@ var __export = (all, symbols) => {
|
|
|
41
41
|
const BAConfigSchema = Schema.object({
|
|
42
42
|
require: Schema.object({}).description("必填设置"),
|
|
43
43
|
key: Schema.string().pattern(/^[0-9a-f]{32}$/).role("secret").required().description("请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/"),
|
|
44
|
-
master: Schema.intersect([Schema.object({ enable: Schema.boolean().default(false).description("
|
|
44
|
+
master: Schema.intersect([Schema.object({ enable: Schema.boolean().default(false).description("是否开启主人账号功能,开启后如果机器人运行错误会向您进行报告。如果您的机器人没有私聊权限请不要开启此功能") }).description("主人账号"), Schema.union([Schema.object({
|
|
45
45
|
enable: Schema.const(true).required(),
|
|
46
46
|
platform: Schema.union([
|
|
47
47
|
"qq",
|
|
@@ -69,19 +69,19 @@ const BAConfigSchema = Schema.object({
|
|
|
69
69
|
subTitle: Schema.object({}).description("订阅配置"),
|
|
70
70
|
advancedSub: Schema.boolean().default(false).description("是否开启高级订阅,高级订阅是独立于本插件的一个专门用于订阅配置的插件,用于高度自定义订阅消息。若开启高级订阅,请打开该选项并下载插件 bilibili-notify-advanced-subscription"),
|
|
71
71
|
subs: Schema.array(Schema.object({
|
|
72
|
-
name: Schema.string().required().description("
|
|
72
|
+
name: Schema.string().required().description("UP昵称"),
|
|
73
73
|
uid: Schema.string().required().description("UID和roomid"),
|
|
74
74
|
dynamic: Schema.boolean().default(true).description("动态"),
|
|
75
|
-
dynamicAtAll: Schema.boolean().default(false).description("
|
|
75
|
+
dynamicAtAll: Schema.boolean().default(false).description("动态@全体"),
|
|
76
76
|
live: Schema.boolean().default(true).description("直播"),
|
|
77
|
-
liveAtAll: Schema.boolean().default(true).description("
|
|
77
|
+
liveAtAll: Schema.boolean().default(true).description("直播@全体"),
|
|
78
78
|
liveGuardBuy: Schema.boolean().default(false).description("上舰消息"),
|
|
79
79
|
superchat: Schema.boolean().default(false).description("SC消息"),
|
|
80
80
|
wordcloud: Schema.boolean().default(true).description("弹幕词云"),
|
|
81
81
|
liveSummary: Schema.boolean().default(true).description("直播总结"),
|
|
82
82
|
platform: Schema.string().required().description("平台名"),
|
|
83
83
|
target: Schema.string().required().description("群号/频道号")
|
|
84
|
-
})).role("table").description("
|
|
84
|
+
})).role("table").description("请在这里填写订阅信息;UP昵称是必填项,影响通知时显示的UP主昵称;UID和roomid,请填写订阅用户的UID,如果经常在初始化插件遇到风控问题,请补充直播间房间号,使用英文逗号分隔例如:1234567,114514;平台名,请填写adapter-xxxx中的xxxx,例如你的机器人使用的是adapter-onebot就填写onebot;群号/频道号,直接填写即可,如果有多个群聊或频道请使用英文逗号分隔,例如:1234567,2345678"),
|
|
85
85
|
dynamic: Schema.object({}).description("动态推送设置"),
|
|
86
86
|
dynamicUrl: Schema.boolean().default(false).description("发送动态时是否同时发送链接。注意:如果使用的是QQ官方机器人不能开启此项!"),
|
|
87
87
|
dynamicCron: Schema.string().default("*/2 * * * *").description("动态监测时间,请填入cron表达式,请勿填入过短时间"),
|
|
@@ -101,8 +101,9 @@ const BAConfigSchema = Schema.object({
|
|
|
101
101
|
"🎖️ 特别嘉奖:-un4 & -un5",
|
|
102
102
|
"你们的弹幕,我们都记录在案!🕵️♀️"
|
|
103
103
|
]).role("table").description("自定义直播总结语,开启弹幕词云自动发送。变量解释:-dmc代表总弹幕发送人数,-mdn代表主播粉丝牌子名,-dca代表总弹幕数,-un1到-un5代表弹幕发送条数前五名用户的用户名,-dc1到-dc5代表弹幕发送条数前五名的弹幕发送数量,数组每一行代表换行"),
|
|
104
|
-
|
|
104
|
+
customGuardBuy: Schema.intersect([Schema.object({ enable: Schema.boolean().default(false).description("是否开启自定义上舰消息功能").experimental() }), Schema.union([Schema.object({
|
|
105
105
|
enable: Schema.const(true).required(),
|
|
106
|
+
guardBuyMsg: Schema.string().default("【-mname的直播间】-uname加入了大航海(-guard)").description("自定义上舰消息,-uname代表用户昵称,-muname代表主播昵称,-guard代表舰长类型"),
|
|
106
107
|
captainImgUrl: Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/captain-Bjw5Byb5.png").description("舰长图片链接"),
|
|
107
108
|
supervisorImgUrl: Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/supervisor-u43ElIjU.png").description("提督图片链接"),
|
|
108
109
|
governorImgUrl: Schema.string().default("https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/governor-DpDXKEdA.png").description("总督图片链接")
|
|
@@ -836,11 +837,12 @@ var ComRegister = class ComRegister {
|
|
|
836
837
|
roomid,
|
|
837
838
|
dynamic: s.dynamic,
|
|
838
839
|
live: s.live,
|
|
840
|
+
liveEnd: true,
|
|
839
841
|
target,
|
|
840
842
|
customCardStyle: { enable: false },
|
|
841
843
|
customLiveMsg: { enable: false },
|
|
842
844
|
customLiveSummary: { enable: false },
|
|
843
|
-
|
|
845
|
+
customGuardBuy: { enable: false }
|
|
844
846
|
};
|
|
845
847
|
});
|
|
846
848
|
return subs;
|
|
@@ -904,15 +906,17 @@ var ComRegister = class ComRegister {
|
|
|
904
906
|
sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
905
907
|
sub.customLiveMsg.customLive = this.config.customLive;
|
|
906
908
|
}
|
|
907
|
-
if (sub.
|
|
908
|
-
if (!sub.
|
|
909
|
-
if (!sub.
|
|
910
|
-
if (!sub.
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
sub.
|
|
914
|
-
sub.
|
|
915
|
-
sub.
|
|
909
|
+
if (sub.customGuardBuy.enable) {
|
|
910
|
+
if (!sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
911
|
+
if (!sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
912
|
+
if (!sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
913
|
+
if (!sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
914
|
+
} else if (this.config.customGuardBuy.enable) {
|
|
915
|
+
sub.customGuardBuy.enable = true;
|
|
916
|
+
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
917
|
+
sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
918
|
+
sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
919
|
+
sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
916
920
|
}
|
|
917
921
|
if (sub.customLiveSummary.enable) {
|
|
918
922
|
if (!sub.customLiveSummary.liveSummary.trim()) sub.customLiveSummary.liveSummary = this.config.liveSummary.join("\n");
|
|
@@ -1460,13 +1464,14 @@ var ComRegister = class ComRegister {
|
|
|
1460
1464
|
},
|
|
1461
1465
|
onGuardBuy: async ({ body }) => {
|
|
1462
1466
|
const msg = await (async () => {
|
|
1463
|
-
if (sub.
|
|
1467
|
+
if (sub.customGuardBuy.enable) {
|
|
1464
1468
|
const guardImg = {
|
|
1465
|
-
[GuardLevel.Jianzhang]: sub.
|
|
1466
|
-
[GuardLevel.Tidu]: sub.
|
|
1467
|
-
[GuardLevel.Zongdu]: sub.
|
|
1469
|
+
[GuardLevel.Jianzhang]: sub.customGuardBuy.captainImgUrl,
|
|
1470
|
+
[GuardLevel.Tidu]: sub.customGuardBuy.supervisorImgUrl,
|
|
1471
|
+
[GuardLevel.Zongdu]: sub.customGuardBuy.governorImgUrl
|
|
1468
1472
|
};
|
|
1469
|
-
|
|
1473
|
+
const msg$1 = sub.customGuardBuy.guardBuyMsg.replace("-uname", body.user.uname).replace("-mname", masterInfo.username).replace("-guard", body.gift_name);
|
|
1474
|
+
return h("message", [h.image(guardImg[body.guard_level]), h.text(msg$1)]);
|
|
1470
1475
|
} else {
|
|
1471
1476
|
const guardImg = ComRegister.GUARD_LEVEL_IMG[body.guard_level];
|
|
1472
1477
|
const data = await this.ctx["bilibili-notify-api"].getUserInfoInLive(body.user.uid.toString(), sub.uid);
|
|
@@ -1549,17 +1554,19 @@ var ComRegister = class ComRegister {
|
|
|
1549
1554
|
})();
|
|
1550
1555
|
liveData.fansChanged = followerChange;
|
|
1551
1556
|
const liveEndMsg = sub.customLiveMsg.customLiveEnd.replace("-name", masterInfo.username).replace("-time", diffTime).replace("-follower_change", followerChange).replaceAll("\\n", "\n");
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
+
if (sub.liveEnd) {
|
|
1558
|
+
await this.sendLiveNotifyCard(LiveType.StopBroadcast, liveData, {
|
|
1559
|
+
liveRoomInfo,
|
|
1560
|
+
masterInfo,
|
|
1561
|
+
cardStyle: sub.customCardStyle
|
|
1562
|
+
}, sub.uid, liveEndMsg);
|
|
1563
|
+
await sendDanmakuWordCloudAndLiveSummary(sub.customLiveSummary.liveSummary);
|
|
1564
|
+
}
|
|
1557
1565
|
if (pushAtTimeTimer) {
|
|
1558
1566
|
pushAtTimeTimer();
|
|
1559
1567
|
pushAtTimeTimer = null;
|
|
1560
1568
|
this.liveWSManager.delete(sub.roomid);
|
|
1561
1569
|
}
|
|
1562
|
-
await sendDanmakuWordCloudAndLiveSummary(sub.customLiveSummary.liveSummary);
|
|
1563
1570
|
}
|
|
1564
1571
|
});
|
|
1565
1572
|
if (!await useLiveRoomInfo(LiveType.FirstLiveBroadcast) && !await useMasterInfo(LiveType.FirstLiveBroadcast)) return this.sendPrivateMsg("获取直播间信息失败,启动直播间弹幕检测失败!");
|
|
@@ -1876,11 +1883,12 @@ var ComRegister = class ComRegister {
|
|
|
1876
1883
|
model: Schema.string().default("gpt-3.5-turbo"),
|
|
1877
1884
|
persona: Schema.string()
|
|
1878
1885
|
}),
|
|
1879
|
-
|
|
1886
|
+
customGuardBuy: Schema.object({
|
|
1880
1887
|
enable: Schema.boolean().default(false).description("是否启用自定义舰长购买图片"),
|
|
1881
1888
|
captainImgUrl: Schema.string().description("舰长图片链接"),
|
|
1882
1889
|
supervisorImgUrl: Schema.string().description("提督图片链接"),
|
|
1883
|
-
governorImgUrl: Schema.string().description("总督图片链接")
|
|
1890
|
+
governorImgUrl: Schema.string().description("总督图片链接"),
|
|
1891
|
+
guardBuyMsg: Schema.string().description("舰长购买消息")
|
|
1884
1892
|
})
|
|
1885
1893
|
});
|
|
1886
1894
|
})(ComRegister || (ComRegister = {}));
|
|
@@ -4423,8 +4431,21 @@ const inject = [
|
|
|
4423
4431
|
];
|
|
4424
4432
|
const name = "bilibili-notify";
|
|
4425
4433
|
const usage = `
|
|
4426
|
-
|
|
4427
|
-
|
|
4434
|
+
<h1>Bilibili-Notify</h1>
|
|
4435
|
+
<p>使用问题请加群咨询 801338523</p>
|
|
4436
|
+
|
|
4437
|
+
---
|
|
4438
|
+
|
|
4439
|
+
使用说明:
|
|
4440
|
+
- 请仔细阅读subs的配置说明,并在订阅配置中填写正确的 UID 和订阅类型
|
|
4441
|
+
- 订阅类型包括:动态、直播等
|
|
4442
|
+
|
|
4443
|
+
注意事项:
|
|
4444
|
+
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4445
|
+
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4446
|
+
- 如果你使用的是 onebot 机器人,平台名请填写 onebot 而不是 qq
|
|
4447
|
+
|
|
4448
|
+
---
|
|
4428
4449
|
`;
|
|
4429
4450
|
let globalConfig;
|
|
4430
4451
|
var ServerManager = class extends Service {
|
|
@@ -4483,7 +4504,7 @@ var ServerManager = class extends Service {
|
|
|
4483
4504
|
customLiveStart: globalConfig.customLiveStart,
|
|
4484
4505
|
customLive: globalConfig.customLive,
|
|
4485
4506
|
customLiveEnd: globalConfig.customLiveEnd,
|
|
4486
|
-
customGuardBuyImg: globalConfig.
|
|
4507
|
+
customGuardBuyImg: globalConfig.customGuardBuy,
|
|
4487
4508
|
dynamicUrl: globalConfig.dynamicUrl,
|
|
4488
4509
|
dynamicCron: globalConfig.dynamicCron,
|
|
4489
4510
|
dynamicVideoUrlToBV: globalConfig.dynamicVideoUrlToBV,
|
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.5.0
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@types/qrcode": "^1.5.6",
|
|
50
50
|
"@types/tough-cookie": "^4.0.5",
|
|
51
51
|
"koishi-plugin-puppeteer": "^3.9.0",
|
|
52
|
-
"tsdown": "^0.16.
|
|
52
|
+
"tsdown": "^0.16.6"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"koishi": "^4.18.9"
|