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.
@@ -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, (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [content, channel.atAll ? (0, jsx_runtime_1.jsx)("at", { type: "all" }) : ''] }));
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
@@ -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.22",
4
+ "version": "2.0.0-alpha.23",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -209,6 +209,7 @@
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
211
  - ver 2.0.0-alpha.22 移除:不需要的服务
212
+ - ver 2.0.0-alpha.23 优化:将艾特全体成员消息单独发送
212
213
 
213
214
  ## 交流群
214
215
 
package/lib/blive.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { Context, Logger } from "koishi";
2
- declare class BLive {
3
- static inject: string[];
4
- ctx: Context;
5
- logger: Logger;
6
- constructor(ctx: Context);
7
- startLiveRoomListener(roomId: number): Promise<void>;
8
- }
9
- export default BLive;
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;