koishi-plugin-bilibili-notify 3.3.13-alpha.2 → 3.3.13
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 +7 -15
- package/lib/index.mjs +7 -15
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -89,7 +89,7 @@ const BAConfigSchema = koishi.Schema.object({
|
|
|
89
89
|
}), koishi.Schema.object({})])]),
|
|
90
90
|
basicSettings: koishi.Schema.object({}).description("基本设置"),
|
|
91
91
|
userAgent: koishi.Schema.string().description("设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111"),
|
|
92
|
-
ai: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启AI功能")
|
|
92
|
+
ai: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启AI功能") }), koishi.Schema.union([koishi.Schema.object({
|
|
93
93
|
enable: koishi.Schema.const(true).required(),
|
|
94
94
|
apiKey: koishi.Schema.string().role("secret").required().description("API KEY"),
|
|
95
95
|
baseURL: koishi.Schema.string().required().description("API 访问地址"),
|
|
@@ -119,7 +119,7 @@ const BAConfigSchema = koishi.Schema.object({
|
|
|
119
119
|
pushImgsInDynamic: koishi.Schema.boolean().default(false).description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
|
|
120
120
|
live: koishi.Schema.object({}).description("直播推送设置"),
|
|
121
121
|
liveDetectType: koishi.Schema.union([koishi.Schema.const("WS").description("使用WebSocket连接到B站消息服务器进行直播检测,推荐使用"), koishi.Schema.const("API").description("通过轮询API发送请求监测直播状态,此模式理论可无限订阅,但容易产生其他问题,功能没有WS模式全面").experimental()]).role("radio").default("WS").description("直播检测方式,WS为连接到B站消息服务器,API为通过轮询发送请求监测,默认使用WS检测"),
|
|
122
|
-
wordcloudStopWords: koishi.Schema.string().description("词云生成时的停用词,多个停用词请使用英文逗号分隔,例如:哔哩哔哩,弹幕,直播,词云")
|
|
122
|
+
wordcloudStopWords: koishi.Schema.string().description("词云生成时的停用词,多个停用词请使用英文逗号分隔,例如:哔哩哔哩,弹幕,直播,词云"),
|
|
123
123
|
liveSummary: koishi.Schema.array(String).default([
|
|
124
124
|
"🔍【弹幕情报站】本场直播数据如下:",
|
|
125
125
|
"🧍♂️ 总共 -dmc 位-mdn上线",
|
|
@@ -148,7 +148,7 @@ const BAConfigSchema = koishi.Schema.object({
|
|
|
148
148
|
enableLargeFont: koishi.Schema.boolean().default(false).description("是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看"),
|
|
149
149
|
font: koishi.Schema.string().description("推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei"),
|
|
150
150
|
filter: koishi.Schema.intersect([koishi.Schema.object({ enable: koishi.Schema.boolean().default(false).description("是否开启动态屏蔽功能") }).description("屏蔽设置"), koishi.Schema.union([koishi.Schema.object({
|
|
151
|
-
enable: koishi.Schema.const(true).required()
|
|
151
|
+
enable: koishi.Schema.const(true).required(),
|
|
152
152
|
notify: koishi.Schema.boolean().default(false).description("动态被屏蔽是否发送提示"),
|
|
153
153
|
regex: koishi.Schema.string().description("正则表达式屏蔽"),
|
|
154
154
|
keywords: koishi.Schema.array(String).description("关键字屏蔽,一个关键字为一项"),
|
|
@@ -1377,7 +1377,7 @@ var ComRegister = class {
|
|
|
1377
1377
|
this.logger.info(res.choices[0].message.content);
|
|
1378
1378
|
return res.choices[0].message.content;
|
|
1379
1379
|
}
|
|
1380
|
-
return customLiveSummary.replace("-dmc", `${
|
|
1380
|
+
return customLiveSummary.replace("-dmc", `${danmakuSenderCount}`).replace("-mdn", masterInfo.medalName).replace("-dca", `${danmakuCount}`).replace("-un1", top5DanmakuSender[0][0]).replace("-dc1", `${top5DanmakuSender[0][1]}`).replace("-un2", top5DanmakuSender[1][0]).replace("-dc2", `${top5DanmakuSender[1][1]}`).replace("-un3", top5DanmakuSender[2][0]).replace("-dc3", `${top5DanmakuSender[2][1]}`).replace("-un4", top5DanmakuSender[3][0]).replace("-dc4", `${top5DanmakuSender[3][1]}`).replace("-un5", top5DanmakuSender[4][0]).replace("-dc5", `${top5DanmakuSender[4][1]}`).replaceAll("\\n", "\n");
|
|
1381
1381
|
})();
|
|
1382
1382
|
await this.broadcastToTargets(sub.uid, [img, summary], PushType.WordCloudAndLiveSummary);
|
|
1383
1383
|
Object.keys(danmakuWeightRecord).forEach((key) => delete danmakuWeightRecord[key]);
|
|
@@ -3456,13 +3456,7 @@ var GenerateImg = class extends koishi.Service {
|
|
|
3456
3456
|
}
|
|
3457
3457
|
unixTimestampToString(timestamp) {
|
|
3458
3458
|
const date = /* @__PURE__ */ new Date(timestamp * 1e3);
|
|
3459
|
-
|
|
3460
|
-
const month = `0${date.getMonth() + 1}`.slice(-2);
|
|
3461
|
-
const day = `0${date.getDate()}`.slice(-2);
|
|
3462
|
-
const hours = `0${date.getHours()}`.slice(-2);
|
|
3463
|
-
const minutes = `0${date.getMinutes()}`.slice(-2);
|
|
3464
|
-
const seconds = `0${date.getSeconds()}`.slice(-2);
|
|
3465
|
-
return `${year}年${month}月${day}日 ${hours}:${minutes}:${seconds}`;
|
|
3459
|
+
return `${date.getFullYear()}年${`0${date.getMonth() + 1}`.slice(-2)}月${`0${date.getDate()}`.slice(-2)}日 ${`0${date.getHours()}`.slice(-2)}:${`0${date.getMinutes()}`.slice(-2)}:${`0${date.getSeconds()}`.slice(-2)}`;
|
|
3466
3460
|
}
|
|
3467
3461
|
};
|
|
3468
3462
|
(function(_GenerateImg) {
|
|
@@ -3646,8 +3640,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3646
3640
|
const value = params[key].toString().replace(chr_filter, "");
|
|
3647
3641
|
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
3648
3642
|
}).join("&");
|
|
3649
|
-
|
|
3650
|
-
return `${query}&w_rid=${wbi_sign}`;
|
|
3643
|
+
return `${query}&w_rid=${(0, md5.default)(query + mixin_key)}`;
|
|
3651
3644
|
}
|
|
3652
3645
|
async getWbi(params) {
|
|
3653
3646
|
const web_keys = this.wbiSign || await this.getWbiKeys();
|
|
@@ -4197,8 +4190,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4197
4190
|
const data = new TextEncoder().encode(`refresh_${timestamp}`);
|
|
4198
4191
|
return new Uint8Array(await node_crypto.default.subtle.encrypt({ name: "RSA-OAEP" }, publicKey, data)).reduce((str, c) => str + c.toString(16).padStart(2, "0"), "");
|
|
4199
4192
|
}
|
|
4200
|
-
const
|
|
4201
|
-
const correspondPath = await getCorrespondPath(ts);
|
|
4193
|
+
const correspondPath = await getCorrespondPath(luxon.DateTime.now().toMillis());
|
|
4202
4194
|
const { data: refreshCsrfHtml } = await this.client.get(`https://www.bilibili.com/correspond/1/${correspondPath}`);
|
|
4203
4195
|
const { document } = new jsdom.JSDOM(refreshCsrfHtml).window;
|
|
4204
4196
|
const targetElement = document.getElementById("1-name");
|
package/lib/index.mjs
CHANGED
|
@@ -54,7 +54,7 @@ const BAConfigSchema = Schema.object({
|
|
|
54
54
|
}), Schema.object({})])]),
|
|
55
55
|
basicSettings: Schema.object({}).description("基本设置"),
|
|
56
56
|
userAgent: Schema.string().description("设置请求头User-Agen,请求出现-352时可以尝试修改,UA获取方法可参考:https://blog.csdn.net/qq_44503987/article/details/104929111"),
|
|
57
|
-
ai: Schema.intersect([Schema.object({ enable: Schema.boolean().default(false).description("是否开启AI功能")
|
|
57
|
+
ai: Schema.intersect([Schema.object({ enable: Schema.boolean().default(false).description("是否开启AI功能") }), Schema.union([Schema.object({
|
|
58
58
|
enable: Schema.const(true).required(),
|
|
59
59
|
apiKey: Schema.string().role("secret").required().description("API KEY"),
|
|
60
60
|
baseURL: Schema.string().required().description("API 访问地址"),
|
|
@@ -84,7 +84,7 @@ const BAConfigSchema = Schema.object({
|
|
|
84
84
|
pushImgsInDynamic: Schema.boolean().default(false).description("是否推送动态中的图片,默认不开启。开启后会单独推送动态中的图片,该功能容易导致QQ风控"),
|
|
85
85
|
live: Schema.object({}).description("直播推送设置"),
|
|
86
86
|
liveDetectType: Schema.union([Schema.const("WS").description("使用WebSocket连接到B站消息服务器进行直播检测,推荐使用"), Schema.const("API").description("通过轮询API发送请求监测直播状态,此模式理论可无限订阅,但容易产生其他问题,功能没有WS模式全面").experimental()]).role("radio").default("WS").description("直播检测方式,WS为连接到B站消息服务器,API为通过轮询发送请求监测,默认使用WS检测"),
|
|
87
|
-
wordcloudStopWords: Schema.string().description("词云生成时的停用词,多个停用词请使用英文逗号分隔,例如:哔哩哔哩,弹幕,直播,词云")
|
|
87
|
+
wordcloudStopWords: Schema.string().description("词云生成时的停用词,多个停用词请使用英文逗号分隔,例如:哔哩哔哩,弹幕,直播,词云"),
|
|
88
88
|
liveSummary: Schema.array(String).default([
|
|
89
89
|
"🔍【弹幕情报站】本场直播数据如下:",
|
|
90
90
|
"🧍♂️ 总共 -dmc 位-mdn上线",
|
|
@@ -113,7 +113,7 @@ const BAConfigSchema = Schema.object({
|
|
|
113
113
|
enableLargeFont: Schema.boolean().default(false).description("是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看"),
|
|
114
114
|
font: Schema.string().description("推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei"),
|
|
115
115
|
filter: Schema.intersect([Schema.object({ enable: Schema.boolean().default(false).description("是否开启动态屏蔽功能") }).description("屏蔽设置"), Schema.union([Schema.object({
|
|
116
|
-
enable: Schema.const(true).required()
|
|
116
|
+
enable: Schema.const(true).required(),
|
|
117
117
|
notify: Schema.boolean().default(false).description("动态被屏蔽是否发送提示"),
|
|
118
118
|
regex: Schema.string().description("正则表达式屏蔽"),
|
|
119
119
|
keywords: Schema.array(String).description("关键字屏蔽,一个关键字为一项"),
|
|
@@ -1342,7 +1342,7 @@ var ComRegister = class {
|
|
|
1342
1342
|
this.logger.info(res.choices[0].message.content);
|
|
1343
1343
|
return res.choices[0].message.content;
|
|
1344
1344
|
}
|
|
1345
|
-
return customLiveSummary.replace("-dmc", `${
|
|
1345
|
+
return customLiveSummary.replace("-dmc", `${danmakuSenderCount}`).replace("-mdn", masterInfo.medalName).replace("-dca", `${danmakuCount}`).replace("-un1", top5DanmakuSender[0][0]).replace("-dc1", `${top5DanmakuSender[0][1]}`).replace("-un2", top5DanmakuSender[1][0]).replace("-dc2", `${top5DanmakuSender[1][1]}`).replace("-un3", top5DanmakuSender[2][0]).replace("-dc3", `${top5DanmakuSender[2][1]}`).replace("-un4", top5DanmakuSender[3][0]).replace("-dc4", `${top5DanmakuSender[3][1]}`).replace("-un5", top5DanmakuSender[4][0]).replace("-dc5", `${top5DanmakuSender[4][1]}`).replaceAll("\\n", "\n");
|
|
1346
1346
|
})();
|
|
1347
1347
|
await this.broadcastToTargets(sub.uid, [img, summary], PushType.WordCloudAndLiveSummary);
|
|
1348
1348
|
Object.keys(danmakuWeightRecord).forEach((key) => delete danmakuWeightRecord[key]);
|
|
@@ -3421,13 +3421,7 @@ var GenerateImg = class extends Service {
|
|
|
3421
3421
|
}
|
|
3422
3422
|
unixTimestampToString(timestamp) {
|
|
3423
3423
|
const date = /* @__PURE__ */ new Date(timestamp * 1e3);
|
|
3424
|
-
|
|
3425
|
-
const month = `0${date.getMonth() + 1}`.slice(-2);
|
|
3426
|
-
const day = `0${date.getDate()}`.slice(-2);
|
|
3427
|
-
const hours = `0${date.getHours()}`.slice(-2);
|
|
3428
|
-
const minutes = `0${date.getMinutes()}`.slice(-2);
|
|
3429
|
-
const seconds = `0${date.getSeconds()}`.slice(-2);
|
|
3430
|
-
return `${year}年${month}月${day}日 ${hours}:${minutes}:${seconds}`;
|
|
3424
|
+
return `${date.getFullYear()}年${`0${date.getMonth() + 1}`.slice(-2)}月${`0${date.getDate()}`.slice(-2)}日 ${`0${date.getHours()}`.slice(-2)}:${`0${date.getMinutes()}`.slice(-2)}:${`0${date.getSeconds()}`.slice(-2)}`;
|
|
3431
3425
|
}
|
|
3432
3426
|
};
|
|
3433
3427
|
(function(_GenerateImg) {
|
|
@@ -3611,8 +3605,7 @@ var BiliAPI = class extends Service {
|
|
|
3611
3605
|
const value = params[key].toString().replace(chr_filter, "");
|
|
3612
3606
|
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
3613
3607
|
}).join("&");
|
|
3614
|
-
|
|
3615
|
-
return `${query}&w_rid=${wbi_sign}`;
|
|
3608
|
+
return `${query}&w_rid=${md5(query + mixin_key)}`;
|
|
3616
3609
|
}
|
|
3617
3610
|
async getWbi(params) {
|
|
3618
3611
|
const web_keys = this.wbiSign || await this.getWbiKeys();
|
|
@@ -4162,8 +4155,7 @@ var BiliAPI = class extends Service {
|
|
|
4162
4155
|
const data = new TextEncoder().encode(`refresh_${timestamp}`);
|
|
4163
4156
|
return new Uint8Array(await crypto.subtle.encrypt({ name: "RSA-OAEP" }, publicKey, data)).reduce((str, c) => str + c.toString(16).padStart(2, "0"), "");
|
|
4164
4157
|
}
|
|
4165
|
-
const
|
|
4166
|
-
const correspondPath = await getCorrespondPath(ts);
|
|
4158
|
+
const correspondPath = await getCorrespondPath(DateTime.now().toMillis());
|
|
4167
4159
|
const { data: refreshCsrfHtml } = await this.client.get(`https://www.bilibili.com/correspond/1/${correspondPath}`);
|
|
4168
4160
|
const { document } = new JSDOM(refreshCsrfHtml).window;
|
|
4169
4161
|
const targetElement = document.getElementById("1-name");
|