koishi-plugin-bilibili-notify 2.0.0-alpha.22 → 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/comRegister.js +6 -2
- package/lib/font/HYZhengYuan-75W.ttf +0 -0
- package/package.json +1 -1
- package/readme.md +1 -0
- package/lib/blive.d.ts +0 -9
- package/lib/blive.js +0 -51
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/package.json
CHANGED
package/readme.md
CHANGED
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;
|