koishi-plugin-bilibili-notify 2.0.0-alpha.21 → 2.0.0-alpha.23
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/biliAPI.d.ts +0 -1
- package/lib/biliAPI.js +0 -15
- package/lib/comRegister.js +6 -2
- package/lib/font/HYZhengYuan-75W.ttf +0 -0
- package/lib/index.js +0 -4
- package/package.json +1 -2
- package/readme.md +2 -0
- package/lib/blive.d.ts +0 -9
- package/lib/blive.js +0 -51
package/lib/biliAPI.d.ts
CHANGED
package/lib/biliAPI.js
CHANGED
|
@@ -375,21 +375,6 @@ class BiliAPI extends koishi_1.Service {
|
|
|
375
375
|
const cookies = JSON.stringify(this.jar.serializeSync().cookies);
|
|
376
376
|
return cookies;
|
|
377
377
|
}
|
|
378
|
-
async getCookiesForHeader() {
|
|
379
|
-
try {
|
|
380
|
-
// 获取cookies对象
|
|
381
|
-
const cookies = this.jar.serializeSync().cookies;
|
|
382
|
-
// 将每个 cookie 对象转换为 "key=value" 形式,并用 "; " 连接起来
|
|
383
|
-
const cookieHeader = cookies
|
|
384
|
-
.map(cookie => `${cookie.key}=${cookie.value}`)
|
|
385
|
-
.join('; ');
|
|
386
|
-
return cookieHeader;
|
|
387
|
-
}
|
|
388
|
-
catch (e) {
|
|
389
|
-
console.error("无效的 JSON 格式:", e);
|
|
390
|
-
return "";
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
378
|
getLoginInfoIsLoaded() {
|
|
394
379
|
return this.loginInfoIsLoaded;
|
|
395
380
|
}
|
package/lib/comRegister.js
CHANGED
|
@@ -671,13 +671,17 @@ class ComRegister {
|
|
|
671
671
|
else {
|
|
672
672
|
sendArr = target.channelIdArr;
|
|
673
673
|
}
|
|
674
|
-
//
|
|
674
|
+
// 判断是否是直播开播推送,如果是则需要进一步判断是否需要艾特群体成员
|
|
675
675
|
if (live) {
|
|
676
676
|
// 直播开播推送,判断是否需要艾特全体成员
|
|
677
677
|
for (const channel of sendArr) {
|
|
678
678
|
// 判断是否需要推送直播消息
|
|
679
679
|
if (channel.live) {
|
|
680
|
-
await this.sendMsgFunc(bot, channel.channelId,
|
|
680
|
+
await this.sendMsgFunc(bot, channel.channelId, content);
|
|
681
|
+
}
|
|
682
|
+
// 判断是否需要艾特全体成员
|
|
683
|
+
if (channel.atAll) {
|
|
684
|
+
await this.sendMsgFunc(bot, channel.channelId, (0, jsx_runtime_1.jsx)("at", { type: "all" }));
|
|
681
685
|
}
|
|
682
686
|
}
|
|
683
687
|
}
|
|
Binary file
|
package/lib/index.js
CHANGED
|
@@ -47,7 +47,6 @@ const Database = __importStar(require("./database"));
|
|
|
47
47
|
// import Service
|
|
48
48
|
const generateImg_1 = __importDefault(require("./generateImg"));
|
|
49
49
|
const biliAPI_1 = __importDefault(require("./biliAPI"));
|
|
50
|
-
const blive_1 = __importDefault(require("./blive"));
|
|
51
50
|
exports.inject = ['puppeteer', 'database', 'notifier'];
|
|
52
51
|
exports.name = 'bilibili-notify';
|
|
53
52
|
let globalConfig;
|
|
@@ -323,13 +322,10 @@ class ServerManager extends koishi_1.Service {
|
|
|
323
322
|
filter: globalConfig.filter,
|
|
324
323
|
dynamicDebugMode: globalConfig.dynamicDebugMode
|
|
325
324
|
});
|
|
326
|
-
// BL = BLive
|
|
327
|
-
const bl = this.ctx.plugin(blive_1.default, {});
|
|
328
325
|
// 添加服务
|
|
329
326
|
this.servers.push(ba);
|
|
330
327
|
this.servers.push(gi);
|
|
331
328
|
this.servers.push(cr);
|
|
332
|
-
this.servers.push(bl);
|
|
333
329
|
}
|
|
334
330
|
catch (e) {
|
|
335
331
|
this.logger.error('插件注册失败', e);
|
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": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.23",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Akokko <admin@akokko.com>"
|
|
7
7
|
],
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"axios": "^1.7.9",
|
|
31
31
|
"axios-cookiejar-support": "^5.0.5",
|
|
32
|
-
"blive-message-listener": "^0.5.0",
|
|
33
32
|
"jsdom": "^24.1.3",
|
|
34
33
|
"luxon": "^3.5.0",
|
|
35
34
|
"md5": "^2.3.0",
|
package/readme.md
CHANGED
|
@@ -208,6 +208,8 @@
|
|
|
208
208
|
- ver 2.0.0-alpha.19 修复:开播通知后带false;下播通知卡片人气位置显示false
|
|
209
209
|
- ver 2.0.0-alpha.20 修复:直播推送失败 `Error with request send_group_msg`
|
|
210
210
|
- ver 2.0.0-alpha.21 修复:在某些场景下仍会出现 `2.0.0-alpha.19` 和 `2.0.0-alpha.20` 版本已修复的问题
|
|
211
|
+
- ver 2.0.0-alpha.22 移除:不需要的服务
|
|
212
|
+
- ver 2.0.0-alpha.23 优化:将艾特全体成员消息单独发送
|
|
211
213
|
|
|
212
214
|
## 交流群
|
|
213
215
|
|
package/lib/blive.d.ts
DELETED
package/lib/blive.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const blive_message_listener_1 = require("blive-message-listener");
|
|
4
|
-
class BLive {
|
|
5
|
-
// 必要服务
|
|
6
|
-
static inject = ['ba'];
|
|
7
|
-
// 定义类属性
|
|
8
|
-
ctx;
|
|
9
|
-
logger;
|
|
10
|
-
constructor(ctx) {
|
|
11
|
-
// 将ctx赋值给类属性
|
|
12
|
-
this.ctx = ctx;
|
|
13
|
-
// 创建logger
|
|
14
|
-
this.logger = ctx.logger('bl');
|
|
15
|
-
// TEST
|
|
16
|
-
ctx.setTimeout(() => {
|
|
17
|
-
this.startLiveRoomListener(732);
|
|
18
|
-
}, 1000);
|
|
19
|
-
}
|
|
20
|
-
async startLiveRoomListener(roomId) {
|
|
21
|
-
// 获取cookieStr
|
|
22
|
-
const cookiesStr = await this.ctx.ba.getCookiesForHeader();
|
|
23
|
-
// 构建消息处理函数
|
|
24
|
-
const handler = {
|
|
25
|
-
onOpen: () => {
|
|
26
|
-
this.logger.info('服务器连接成功');
|
|
27
|
-
},
|
|
28
|
-
onClose: () => {
|
|
29
|
-
this.logger.info('服务器连接已断开');
|
|
30
|
-
},
|
|
31
|
-
onIncomeDanmu: (msg) => {
|
|
32
|
-
console.log(msg.id, msg.body);
|
|
33
|
-
},
|
|
34
|
-
onIncomeSuperChat: (msg) => {
|
|
35
|
-
console.log(msg.id, msg.body);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
// 获取自身信息
|
|
39
|
-
const mySelfInfo = await this.ctx.ba.getMyselfInfo();
|
|
40
|
-
// 创建实例
|
|
41
|
-
(0, blive_message_listener_1.startListen)(roomId, handler, {
|
|
42
|
-
ws: {
|
|
43
|
-
headers: {
|
|
44
|
-
Cookie: cookiesStr
|
|
45
|
-
},
|
|
46
|
-
uid: mySelfInfo.data.mid
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.default = BLive;
|