floating-live 0.11.1 → 0.12.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/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -2
- package/plugin/acfun/acfunLive.d.ts +3 -2
- package/plugin/acfun/acfunLive.js +61 -38
- package/plugin/bilibili/bilibiliLive.d.ts +5 -4
- package/plugin/bilibili/bilibiliLive.js +149 -88
- package/src/lib/LiveRoom.d.ts +4 -4
- package/src/lib/LiveRoom.js +5 -4
- package/src/module/Room.js +2 -2
- package/src/tool.d.ts +2 -0
- package/src/tool.js +21 -0
- package/src/types/message/AttributeInfo.d.ts +2 -2
- package/src/types/message/MessageData.d.ts +31 -29
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "floating-live",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"acfun-live-danmaku": "^0.6.1",
|
|
19
19
|
"axios": "^1.4.0",
|
|
20
|
-
"bilibili-live-ws": "^6.
|
|
20
|
+
"bilibili-live-ws": "^6.3.1",
|
|
21
21
|
"fs-extra": "^11.1.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { RoomDetail } from './../../src/lib/LiveRoom';
|
|
1
2
|
import { MedalInfo, UserInfo } from "../..";
|
|
2
3
|
import AcClient from "acfun-live-danmaku/client";
|
|
3
|
-
import { LiveRoom, RoomStatsInfo
|
|
4
|
+
import { LiveRoom, RoomStatsInfo } from "../..";
|
|
4
5
|
declare type ZtLiveUserInfo = {
|
|
5
6
|
userIdentity: {
|
|
6
7
|
managerType?: number;
|
|
@@ -20,7 +21,7 @@ declare class acfunLive extends LiveRoom {
|
|
|
20
21
|
/** 房间id */
|
|
21
22
|
readonly id: number;
|
|
22
23
|
/** 直播展示信息 */
|
|
23
|
-
|
|
24
|
+
detail: RoomDetail;
|
|
24
25
|
/** 直播数据信息 */
|
|
25
26
|
stats: RoomStatsInfo;
|
|
26
27
|
/** 主播信息 */
|
|
@@ -24,7 +24,7 @@ class acfunLive extends __1.LiveRoom {
|
|
|
24
24
|
/** 平台id */
|
|
25
25
|
this.platform = "acfun";
|
|
26
26
|
/** 直播展示信息 */
|
|
27
|
-
this.
|
|
27
|
+
this.detail = {
|
|
28
28
|
/** 直播标题 */
|
|
29
29
|
title: "",
|
|
30
30
|
/** 分区 */
|
|
@@ -60,18 +60,17 @@ class acfunLive extends __1.LiveRoom {
|
|
|
60
60
|
get available() {
|
|
61
61
|
return Boolean(this.client);
|
|
62
62
|
}
|
|
63
|
-
;
|
|
64
63
|
async getInfo() {
|
|
65
64
|
if (!this.client) {
|
|
66
|
-
this.client = await (0, acfun_live_danmaku_1.default)(this.id) || null;
|
|
65
|
+
this.client = (await (0, acfun_live_danmaku_1.default)(this.id)) || null;
|
|
67
66
|
if (this.client) {
|
|
68
67
|
this.status = __2.RoomStatus.live;
|
|
69
68
|
this.timestamp = this.client.liveStartTime;
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
69
|
+
this.detail.title = this.client.caption; // bug
|
|
70
|
+
this.detail.cover = `https://tx2.a.kwimgs.com/bs2/ztlc/cover_${this.client.liveId}_raw.jpg`;
|
|
72
71
|
}
|
|
73
72
|
await fetch(`https://live.acfun.cn/rest/pc-direct/user/userInfo?userId=${this.id}`, {
|
|
74
|
-
method: "GET"
|
|
73
|
+
method: "GET",
|
|
75
74
|
})
|
|
76
75
|
.then((response) => response.json())
|
|
77
76
|
.then((res) => {
|
|
@@ -114,13 +113,26 @@ class acfunLive extends __1.LiveRoom {
|
|
|
114
113
|
//收到的弹幕
|
|
115
114
|
this.msg_Comment(danmaku);
|
|
116
115
|
});
|
|
117
|
-
client.on("Gift", (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
client.on("
|
|
116
|
+
client.on("Gift", (msg) => {
|
|
117
|
+
this.msg_Gift(msg);
|
|
118
|
+
});
|
|
119
|
+
client.on("UserEnterRoom", (msg) => {
|
|
120
|
+
this.msg_Interact(msg, "entry");
|
|
121
|
+
});
|
|
122
|
+
client.on("Like", (msg) => {
|
|
123
|
+
this.msg_Interact(msg, "like");
|
|
124
|
+
});
|
|
125
|
+
// client.on("UserFollowAuthor", (join: any) => { this.msg_Interact(msg, "follow"); });
|
|
126
|
+
// client.on("JoinClub", (msg: any) => { this.msg_Interact(msg, "join"); });
|
|
127
|
+
client.on("DisplayInfo", (msg) => {
|
|
128
|
+
this.msg_DisplayInfo(msg);
|
|
129
|
+
});
|
|
130
|
+
client.on("LiveClosed", (msg) => {
|
|
131
|
+
this.msg_LiveClosed();
|
|
132
|
+
});
|
|
133
|
+
client.on("LiveBanned", (msg) => {
|
|
134
|
+
this.msg_LiveBanned();
|
|
135
|
+
});
|
|
124
136
|
this.wsInit = true;
|
|
125
137
|
}
|
|
126
138
|
/** 关闭直播间监听 */
|
|
@@ -135,7 +147,6 @@ class acfunLive extends __1.LiveRoom {
|
|
|
135
147
|
this.close();
|
|
136
148
|
this.removeAllListeners();
|
|
137
149
|
}
|
|
138
|
-
;
|
|
139
150
|
/** 根据守护徽章字符串获取粉丝牌信息 */
|
|
140
151
|
getMedal(badge) {
|
|
141
152
|
if (badge) {
|
|
@@ -163,32 +174,36 @@ class acfunLive extends __1.LiveRoom {
|
|
|
163
174
|
id: parseInt(user.userId),
|
|
164
175
|
medal: this.getMedal(user.badge),
|
|
165
176
|
avatar: user.avatar[0].url,
|
|
166
|
-
admin: identity
|
|
177
|
+
admin: identity,
|
|
167
178
|
};
|
|
168
179
|
}
|
|
169
180
|
/** 文本信息(Comment) */
|
|
170
181
|
msg_Comment(data) {
|
|
171
|
-
|
|
182
|
+
const userInfo = this.getUser(data.userInfo);
|
|
183
|
+
let m = {
|
|
172
184
|
platform: "acfun",
|
|
173
185
|
room: this.id,
|
|
186
|
+
id: `${userInfo.id}-${data.sendTimeMs}`,
|
|
174
187
|
timestamp: parseInt(data.sendTimeMs),
|
|
175
188
|
type: "chat",
|
|
176
189
|
info: {
|
|
177
190
|
content: data.content,
|
|
178
|
-
user:
|
|
191
|
+
user: userInfo,
|
|
179
192
|
},
|
|
180
193
|
};
|
|
181
|
-
this.emitMsg(
|
|
194
|
+
this.emitMsg(m);
|
|
182
195
|
}
|
|
183
196
|
/** 礼物信息(Gift) */
|
|
184
197
|
msg_Gift(data) {
|
|
185
|
-
|
|
198
|
+
const userInfo = this.getUser(data.user);
|
|
199
|
+
let m = {
|
|
186
200
|
platform: "acfun",
|
|
187
201
|
room: this.id,
|
|
188
202
|
type: "gift",
|
|
203
|
+
id: `${userInfo.id}-${data.sendTimeMs}`,
|
|
189
204
|
timestamp: parseInt(data.sendTimeMs),
|
|
190
205
|
info: {
|
|
191
|
-
user:
|
|
206
|
+
user: userInfo,
|
|
192
207
|
gift: {
|
|
193
208
|
name: data.giftName,
|
|
194
209
|
id: parseInt(data.giftId),
|
|
@@ -198,59 +213,67 @@ class acfunLive extends __1.LiveRoom {
|
|
|
198
213
|
},
|
|
199
214
|
},
|
|
200
215
|
};
|
|
201
|
-
this.emitMsg(
|
|
216
|
+
this.emitMsg(m);
|
|
202
217
|
}
|
|
203
218
|
/** 互动信息 */
|
|
204
219
|
msg_Interact(data, type) {
|
|
205
|
-
|
|
220
|
+
const userInfo = this.getUser(data.userInfo);
|
|
221
|
+
let m = {
|
|
206
222
|
platform: "acfun",
|
|
207
223
|
room: this.id,
|
|
208
224
|
type: type,
|
|
225
|
+
id: `${userInfo.id}-${data.sendTimeMs}`,
|
|
209
226
|
timestamp: parseInt(data.sendTimeMs),
|
|
210
227
|
info: {
|
|
211
|
-
user:
|
|
228
|
+
user: userInfo,
|
|
212
229
|
},
|
|
213
230
|
};
|
|
214
|
-
this.emitMsg(
|
|
231
|
+
this.emitMsg(m);
|
|
215
232
|
}
|
|
216
233
|
msg_LiveClosed() {
|
|
217
|
-
|
|
234
|
+
const timestamp = getDateTimestamp();
|
|
235
|
+
let m = {
|
|
218
236
|
platform: "acfun",
|
|
219
237
|
room: this.id,
|
|
220
238
|
type: "live_end",
|
|
221
|
-
|
|
239
|
+
id: `${timestamp}`,
|
|
240
|
+
timestamp: timestamp,
|
|
222
241
|
info: {
|
|
223
|
-
status: __2.RoomStatus.off
|
|
224
|
-
}
|
|
242
|
+
status: __2.RoomStatus.off,
|
|
243
|
+
},
|
|
225
244
|
};
|
|
226
245
|
this.client = null;
|
|
227
|
-
this.emitMsg(
|
|
246
|
+
this.emitMsg(m);
|
|
228
247
|
}
|
|
229
248
|
msg_LiveBanned() {
|
|
230
|
-
|
|
249
|
+
const timestamp = getDateTimestamp();
|
|
250
|
+
let m = {
|
|
231
251
|
platform: "acfun",
|
|
232
252
|
room: this.id,
|
|
233
253
|
type: "live_cut",
|
|
234
|
-
|
|
254
|
+
id: `${timestamp}`,
|
|
255
|
+
timestamp: timestamp,
|
|
235
256
|
info: {
|
|
236
|
-
message: ""
|
|
237
|
-
}
|
|
257
|
+
message: "",
|
|
258
|
+
},
|
|
238
259
|
};
|
|
239
260
|
this.client = null;
|
|
240
|
-
this.emitMsg(
|
|
261
|
+
this.emitMsg(m);
|
|
241
262
|
}
|
|
242
263
|
msg_DisplayInfo(data) {
|
|
243
|
-
|
|
264
|
+
const timestamp = getDateTimestamp();
|
|
265
|
+
let m = {
|
|
244
266
|
platform: "acfun",
|
|
245
267
|
room: this.id,
|
|
246
268
|
type: "live_stats",
|
|
247
|
-
|
|
269
|
+
id: `${timestamp}`,
|
|
270
|
+
timestamp: timestamp,
|
|
248
271
|
info: {
|
|
249
272
|
like: stringToNumber(data.likeCount),
|
|
250
273
|
online: stringToNumber(data.watchingCount),
|
|
251
|
-
}
|
|
274
|
+
},
|
|
252
275
|
};
|
|
253
|
-
this.emitMsg(
|
|
276
|
+
this.emitMsg(m);
|
|
254
277
|
}
|
|
255
278
|
}
|
|
256
279
|
exports.default = acfunLive;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserInfo } from "../..";
|
|
2
2
|
import { KeepLiveWS } from "bilibili-live-ws";
|
|
3
|
-
import { LiveRoom, RoomStatsInfo,
|
|
3
|
+
import { LiveRoom, RoomStatsInfo, RoomDetail } from "../..";
|
|
4
4
|
declare class bilibiliLive extends LiveRoom {
|
|
5
5
|
/** 平台id */
|
|
6
6
|
readonly platform: string;
|
|
@@ -8,8 +8,8 @@ declare class bilibiliLive extends LiveRoom {
|
|
|
8
8
|
readonly id: number;
|
|
9
9
|
/** 直播间room_id */
|
|
10
10
|
roomid: number;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/** 房间信息 */
|
|
12
|
+
detail: RoomDetail;
|
|
13
13
|
stats: RoomStatsInfo;
|
|
14
14
|
/** 房间是否可用 */
|
|
15
15
|
available: boolean;
|
|
@@ -27,7 +27,7 @@ declare class bilibiliLive extends LiveRoom {
|
|
|
27
27
|
connectInterval: number;
|
|
28
28
|
});
|
|
29
29
|
/** 获取房间信息 */
|
|
30
|
-
getInfo(
|
|
30
|
+
getInfo(): Promise<void>;
|
|
31
31
|
/** 开启直播间监听 */
|
|
32
32
|
open(): Promise<void>;
|
|
33
33
|
/** 连接直播服务端 */
|
|
@@ -48,6 +48,7 @@ declare class bilibiliLive extends LiveRoom {
|
|
|
48
48
|
msg_WATCHED_CHANGE(msg: any): void;
|
|
49
49
|
/** 点赞数变化 */
|
|
50
50
|
msg_LIKE_INFO_V3_UPDATE(msg: any): void;
|
|
51
|
+
msg_ONLINE_RANK_COUNT(msg: any): void;
|
|
51
52
|
msg_ROOM_BLOCK_MSG(msg: any): void;
|
|
52
53
|
msg_LIVE(msg: any): void;
|
|
53
54
|
msg_CUT_OFF(msg: any): void;
|
|
@@ -8,6 +8,16 @@ const __2 = require("../..");
|
|
|
8
8
|
function getDateTimestamp() {
|
|
9
9
|
return Math.floor(Date.now() / 1000) * 1000;
|
|
10
10
|
}
|
|
11
|
+
function getRoomStatus(s) {
|
|
12
|
+
switch (s) {
|
|
13
|
+
case 1:
|
|
14
|
+
return __1.RoomStatus.live;
|
|
15
|
+
case 2:
|
|
16
|
+
return __1.RoomStatus.round;
|
|
17
|
+
default:
|
|
18
|
+
return __1.RoomStatus.off;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
11
21
|
class bilibiliLive extends __2.LiveRoom {
|
|
12
22
|
constructor(id, // 房间id
|
|
13
23
|
open = false, // 生成房间后是否打开
|
|
@@ -17,8 +27,8 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
17
27
|
this.platform = "bilibili";
|
|
18
28
|
/** 直播间room_id */
|
|
19
29
|
this.roomid = 0;
|
|
20
|
-
/**
|
|
21
|
-
this.
|
|
30
|
+
/** 房间信息 */
|
|
31
|
+
this.detail = {
|
|
22
32
|
/** 直播标题 */
|
|
23
33
|
title: "",
|
|
24
34
|
/** 分区 */
|
|
@@ -50,19 +60,26 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
/** 获取房间信息 */
|
|
53
|
-
async getInfo(
|
|
63
|
+
async getInfo() {
|
|
54
64
|
await fetch(`https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=${this.id}`, {
|
|
55
|
-
method: "GET"
|
|
65
|
+
method: "GET",
|
|
56
66
|
}) // 获取直播间信息
|
|
57
67
|
.then((response) => response.json())
|
|
58
68
|
.then((res) => {
|
|
59
|
-
const { room_info, anchor_info } = res.data;
|
|
69
|
+
const { room_info, anchor_info, like_info_v3, watched_show } = res.data;
|
|
60
70
|
this.roomid = room_info.room_id;
|
|
61
|
-
this.status = room_info.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.
|
|
65
|
-
|
|
71
|
+
this.status = room_info.lock_status
|
|
72
|
+
? __1.RoomStatus.banned
|
|
73
|
+
: getRoomStatus(room_info.live_status);
|
|
74
|
+
this.timestamp =
|
|
75
|
+
this.status == __1.RoomStatus.live
|
|
76
|
+
? room_info.live_start_time * 1000
|
|
77
|
+
: this.timestamp;
|
|
78
|
+
this.detail.title = room_info.title;
|
|
79
|
+
this.detail.area = [room_info.parent_area_name, room_info.area_name];
|
|
80
|
+
this.detail.cover = room_info.cover;
|
|
81
|
+
this.stats.watch = watched_show.num;
|
|
82
|
+
this.stats.like = like_info_v3.total_likes;
|
|
66
83
|
this.anchor.id = room_info.uid;
|
|
67
84
|
this.anchor.name = anchor_info.base_info.uname;
|
|
68
85
|
this.anchor.avatar = anchor_info.base_info.face;
|
|
@@ -80,7 +97,7 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
80
97
|
// 如果直播间监听已打开,则返回
|
|
81
98
|
if (this.opening)
|
|
82
99
|
return;
|
|
83
|
-
await this.getInfo(
|
|
100
|
+
await this.getInfo();
|
|
84
101
|
// 如果直播间不可用,则返回
|
|
85
102
|
if (!this.available)
|
|
86
103
|
return;
|
|
@@ -92,7 +109,7 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
92
109
|
async createWS() {
|
|
93
110
|
// 与Websocket服务器连接
|
|
94
111
|
console.log("[bilibili-live-ws] 开始连接bilibili直播服务器");
|
|
95
|
-
this.client = new bilibili_live_ws_1.KeepLiveWS(this.roomid);
|
|
112
|
+
this.client = new bilibili_live_ws_1.KeepLiveWS(this.roomid, { uid: this.anchor.id });
|
|
96
113
|
let client = this.client;
|
|
97
114
|
client.interval = this.connectInterval;
|
|
98
115
|
client.on("open", () => {
|
|
@@ -123,6 +140,7 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
123
140
|
client.on("ROOM_CHANGE", this.msg_ROOM_CHANGE.bind(this));
|
|
124
141
|
client.on("WATCHED_CHANGE", this.msg_WATCHED_CHANGE.bind(this));
|
|
125
142
|
client.on("LIKE_INFO_V3_UPDATE", this.msg_LIKE_INFO_V3_UPDATE.bind(this));
|
|
143
|
+
client.on("ONLINE_RANK_COUNT", this.msg_ONLINE_RANK_COUNT.bind(this));
|
|
126
144
|
}
|
|
127
145
|
/** 关闭直播间监听 */
|
|
128
146
|
close() {
|
|
@@ -134,21 +152,24 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
134
152
|
}
|
|
135
153
|
/** 获取弹幕消息 */
|
|
136
154
|
msg_DANMU_MSG(msg) {
|
|
137
|
-
|
|
138
|
-
let
|
|
139
|
-
let
|
|
140
|
-
let
|
|
141
|
-
let
|
|
142
|
-
let
|
|
143
|
-
let
|
|
144
|
-
let
|
|
145
|
-
let
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
const { info, msg_id } = msg;
|
|
156
|
+
let content = info[1];
|
|
157
|
+
let mode = info[0][1];
|
|
158
|
+
let color = info[0][3];
|
|
159
|
+
let uname = info[2][1];
|
|
160
|
+
let uid = info[2][0];
|
|
161
|
+
let timestamp = info[0][4];
|
|
162
|
+
let guard_level = info[7]; // 舰长级别
|
|
163
|
+
let extra = JSON.parse(info[0][15].extra);
|
|
164
|
+
let medal = info[3].length
|
|
165
|
+
? {
|
|
166
|
+
level: info[3][0],
|
|
167
|
+
name: info[3][1],
|
|
168
|
+
// user: info[3][2],
|
|
169
|
+
id: info[3][12],
|
|
170
|
+
membership: info[3][10] || 0,
|
|
171
|
+
}
|
|
172
|
+
: null;
|
|
152
173
|
let identity = null;
|
|
153
174
|
let emoticon = undefined;
|
|
154
175
|
if (extra.emots) {
|
|
@@ -162,7 +183,7 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
162
183
|
};
|
|
163
184
|
}
|
|
164
185
|
}
|
|
165
|
-
if (
|
|
186
|
+
if (info[2][2]) {
|
|
166
187
|
identity = __1.UserAdmin.admin;
|
|
167
188
|
}
|
|
168
189
|
else if (uid == this.anchor.id) {
|
|
@@ -173,16 +194,21 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
173
194
|
room: this.id,
|
|
174
195
|
type: "chat",
|
|
175
196
|
timestamp: timestamp,
|
|
197
|
+
id: msg_id,
|
|
176
198
|
info: {
|
|
177
199
|
color: color,
|
|
178
200
|
mode: mode,
|
|
179
201
|
content: content,
|
|
180
|
-
image:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
202
|
+
image: info[0][12]
|
|
203
|
+
? {
|
|
204
|
+
name: content,
|
|
205
|
+
id: info[0][13].emoticon_unique,
|
|
206
|
+
url: info[0][13].url,
|
|
207
|
+
size: info[0][13].width == info[0][13].height
|
|
208
|
+
? __1.ImageSize.large
|
|
209
|
+
: __1.ImageSize.small,
|
|
210
|
+
}
|
|
211
|
+
: undefined,
|
|
186
212
|
emoticon: emoticon,
|
|
187
213
|
user: {
|
|
188
214
|
name: uname,
|
|
@@ -190,14 +216,14 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
190
216
|
medal: medal,
|
|
191
217
|
membership: guard_level,
|
|
192
218
|
admin: identity,
|
|
193
|
-
}
|
|
194
|
-
}
|
|
219
|
+
},
|
|
220
|
+
},
|
|
195
221
|
};
|
|
196
222
|
this.emitMsg(danmaku);
|
|
197
223
|
}
|
|
198
224
|
/** 获取互动消息 */
|
|
199
225
|
msg_INTERACT_WORD(msg) {
|
|
200
|
-
const data = msg
|
|
226
|
+
const { data, msg_id, send_time } = msg;
|
|
201
227
|
let type;
|
|
202
228
|
switch (data.msg_type) {
|
|
203
229
|
case 1:
|
|
@@ -216,42 +242,48 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
216
242
|
platform: "bilibili",
|
|
217
243
|
room: this.id,
|
|
218
244
|
type: type,
|
|
219
|
-
|
|
245
|
+
id: msg_id,
|
|
246
|
+
timestamp: send_time,
|
|
220
247
|
info: {
|
|
221
248
|
user: {
|
|
222
249
|
name: data.uname,
|
|
223
250
|
id: data.uid,
|
|
224
|
-
medal:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
251
|
+
medal: data.fans_medal?.medal_level
|
|
252
|
+
? {
|
|
253
|
+
level: data.fans_medal.medal_level,
|
|
254
|
+
name: data.fans_medal.medal_name,
|
|
255
|
+
id: data.fans_medal.target_id,
|
|
256
|
+
membership: data.fans_medal.guard_level,
|
|
257
|
+
}
|
|
258
|
+
: null,
|
|
259
|
+
},
|
|
231
260
|
},
|
|
232
261
|
};
|
|
233
262
|
this.emitMsg(interact);
|
|
234
263
|
}
|
|
235
264
|
/** 获取礼物消息 */
|
|
236
265
|
msg_SEND_GIFT(msg) {
|
|
237
|
-
const data = msg
|
|
266
|
+
const { data, msg_id, send_time } = msg;
|
|
238
267
|
let gift = {
|
|
239
268
|
platform: "bilibili",
|
|
240
269
|
room: this.id,
|
|
241
270
|
type: "gift",
|
|
242
|
-
|
|
271
|
+
id: msg_id,
|
|
272
|
+
timestamp: send_time,
|
|
243
273
|
info: {
|
|
244
274
|
user: {
|
|
245
275
|
name: data.uname,
|
|
246
276
|
id: data.uid,
|
|
247
|
-
medal:
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
277
|
+
medal: data.fans_medal && data.fans_medal.medal_level
|
|
278
|
+
? {
|
|
279
|
+
level: data.fans_medal.medal_level,
|
|
280
|
+
name: data.fans_medal.medal_name,
|
|
281
|
+
id: data.fans_medal.target_id,
|
|
282
|
+
membership: data.fans_medal.guard_level,
|
|
283
|
+
}
|
|
284
|
+
: null,
|
|
253
285
|
membership: data.guard_level,
|
|
254
|
-
avatar: data.face
|
|
286
|
+
avatar: data.face,
|
|
255
287
|
},
|
|
256
288
|
gift: {
|
|
257
289
|
name: data.giftName,
|
|
@@ -260,20 +292,21 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
260
292
|
value: data.total_coin,
|
|
261
293
|
currency: data.coin_type,
|
|
262
294
|
action: data.action,
|
|
263
|
-
|
|
264
|
-
}
|
|
295
|
+
comboId: data.batch_combo_id,
|
|
296
|
+
},
|
|
265
297
|
},
|
|
266
298
|
};
|
|
267
299
|
this.emitMsg(gift);
|
|
268
300
|
}
|
|
269
301
|
/** 获取舰长开通消息 */
|
|
270
302
|
msg_GUARD_BUY(msg) {
|
|
271
|
-
const data = msg
|
|
303
|
+
const { data, msg_id, send_time } = msg;
|
|
272
304
|
let gift = {
|
|
273
305
|
platform: "bilibili",
|
|
274
306
|
room: this.id,
|
|
275
307
|
type: "membership",
|
|
276
|
-
|
|
308
|
+
id: msg_id,
|
|
309
|
+
timestamp: send_time,
|
|
277
310
|
info: {
|
|
278
311
|
user: {
|
|
279
312
|
name: data.username,
|
|
@@ -296,24 +329,27 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
296
329
|
}
|
|
297
330
|
/** 获取醒目留言消息 */
|
|
298
331
|
msg_SUPER_CHAT_MESSAGE(msg) {
|
|
299
|
-
const data = msg
|
|
332
|
+
const { data, msg_id, send_time } = msg;
|
|
300
333
|
let sc = {
|
|
301
334
|
platform: "bilibili",
|
|
302
335
|
room: this.id,
|
|
303
336
|
type: "superchat",
|
|
304
|
-
|
|
337
|
+
id: msg_id,
|
|
338
|
+
timestamp: send_time,
|
|
305
339
|
info: {
|
|
306
340
|
id: data.id,
|
|
307
341
|
user: {
|
|
308
342
|
name: data.user_info.uname,
|
|
309
343
|
id: data.uid,
|
|
310
344
|
avatar: data.user_info.face,
|
|
311
|
-
medal:
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
345
|
+
medal: data.medal_info && data.medal_info.medal_level
|
|
346
|
+
? {
|
|
347
|
+
level: data.medal_info.medal_level,
|
|
348
|
+
name: data.medal_info.medal_name,
|
|
349
|
+
id: data.medal_info.target_id,
|
|
350
|
+
membership: data.medal_info.guard_level,
|
|
351
|
+
}
|
|
352
|
+
: null,
|
|
317
353
|
membership: data.user_info.guard_level,
|
|
318
354
|
},
|
|
319
355
|
content: data.message,
|
|
@@ -325,67 +361,86 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
325
361
|
num: data.gift.num,
|
|
326
362
|
value: data.price * 1000,
|
|
327
363
|
currency: "gold",
|
|
328
|
-
}
|
|
364
|
+
},
|
|
329
365
|
},
|
|
330
366
|
};
|
|
331
367
|
this.emitMsg(sc);
|
|
332
368
|
}
|
|
333
369
|
/** 观看数变化 */
|
|
334
370
|
msg_WATCHED_CHANGE(msg) {
|
|
335
|
-
const data = msg
|
|
371
|
+
const { data, msg_id, send_time } = msg;
|
|
336
372
|
const stats = {
|
|
337
373
|
platform: "bilibili",
|
|
338
374
|
room: this.id,
|
|
339
375
|
type: "live_stats",
|
|
340
|
-
|
|
376
|
+
id: msg_id,
|
|
377
|
+
timestamp: send_time,
|
|
341
378
|
info: {
|
|
342
|
-
watch: data.num
|
|
379
|
+
watch: data.num,
|
|
343
380
|
},
|
|
344
381
|
};
|
|
345
382
|
this.emitMsg(stats);
|
|
346
383
|
}
|
|
347
384
|
/** 点赞数变化 */
|
|
348
385
|
msg_LIKE_INFO_V3_UPDATE(msg) {
|
|
349
|
-
const data = msg
|
|
386
|
+
const { data, msg_id, send_time } = msg;
|
|
387
|
+
const stats = {
|
|
388
|
+
platform: "bilibili",
|
|
389
|
+
room: this.id,
|
|
390
|
+
type: "live_stats",
|
|
391
|
+
id: msg_id,
|
|
392
|
+
timestamp: send_time,
|
|
393
|
+
info: {
|
|
394
|
+
like: data.click_count,
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
this.emitMsg(stats);
|
|
398
|
+
}
|
|
399
|
+
msg_ONLINE_RANK_COUNT(msg) {
|
|
400
|
+
const { data, msg_id, send_time } = msg;
|
|
350
401
|
const stats = {
|
|
351
402
|
platform: "bilibili",
|
|
352
403
|
room: this.id,
|
|
353
404
|
type: "live_stats",
|
|
354
|
-
|
|
405
|
+
id: msg_id,
|
|
406
|
+
timestamp: send_time,
|
|
355
407
|
info: {
|
|
356
|
-
|
|
408
|
+
online: data.count,
|
|
357
409
|
},
|
|
358
410
|
};
|
|
359
411
|
this.emitMsg(stats);
|
|
360
412
|
}
|
|
361
413
|
msg_ROOM_BLOCK_MSG(msg) {
|
|
362
414
|
// 禁言
|
|
363
|
-
const data = msg
|
|
415
|
+
const { data, msg_id, send_time } = msg;
|
|
364
416
|
const block = {
|
|
365
417
|
platform: "bilibili",
|
|
366
418
|
room: this.id,
|
|
367
419
|
type: "block",
|
|
368
|
-
|
|
420
|
+
id: msg_id,
|
|
421
|
+
timestamp: send_time,
|
|
369
422
|
info: {
|
|
370
423
|
user: {
|
|
371
424
|
id: data.uid,
|
|
372
|
-
name: data.uname
|
|
425
|
+
name: data.uname,
|
|
373
426
|
},
|
|
374
427
|
operator: {
|
|
375
|
-
admin: data.operator == 2 ? __1.UserAdmin.anchor : __1.UserAdmin.admin
|
|
376
|
-
}
|
|
428
|
+
admin: data.operator == 2 ? __1.UserAdmin.anchor : __1.UserAdmin.admin,
|
|
429
|
+
},
|
|
377
430
|
},
|
|
378
431
|
};
|
|
379
432
|
this.emitMsg(block);
|
|
380
433
|
}
|
|
381
434
|
msg_LIVE(msg) {
|
|
435
|
+
const { data, msg_id, send_time } = msg;
|
|
382
436
|
// 直播间开播
|
|
383
437
|
if (msg.live_time) {
|
|
384
438
|
let live = {
|
|
385
439
|
platform: "bilibili",
|
|
386
440
|
room: this.id,
|
|
387
441
|
type: "live_start",
|
|
388
|
-
|
|
442
|
+
id: msg_id,
|
|
443
|
+
timestamp: send_time,
|
|
389
444
|
info: {
|
|
390
445
|
id: msg.live_key.toString(),
|
|
391
446
|
},
|
|
@@ -394,12 +449,14 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
394
449
|
}
|
|
395
450
|
}
|
|
396
451
|
msg_CUT_OFF(msg) {
|
|
452
|
+
const { msg_id, send_time } = msg;
|
|
397
453
|
// 直播间被切断
|
|
398
454
|
let cut = {
|
|
399
455
|
platform: "bilibili",
|
|
400
456
|
room: this.id,
|
|
401
457
|
type: "live_cut",
|
|
402
|
-
|
|
458
|
+
id: msg_id,
|
|
459
|
+
timestamp: send_time,
|
|
403
460
|
info: {
|
|
404
461
|
message: msg.msg,
|
|
405
462
|
},
|
|
@@ -407,27 +464,31 @@ class bilibiliLive extends __2.LiveRoom {
|
|
|
407
464
|
this.emitMsg(cut);
|
|
408
465
|
}
|
|
409
466
|
msg_PREPARING(msg) {
|
|
467
|
+
const { msg_id, send_time } = msg;
|
|
410
468
|
let off = {
|
|
411
469
|
platform: "bilibili",
|
|
412
470
|
room: this.id,
|
|
413
471
|
type: "live_end",
|
|
414
|
-
|
|
472
|
+
id: msg_id,
|
|
473
|
+
timestamp: send_time,
|
|
415
474
|
info: {
|
|
416
|
-
status: msg.round ? __1.RoomStatus.round : __1.RoomStatus.off
|
|
417
|
-
}
|
|
475
|
+
status: msg.round ? __1.RoomStatus.round : __1.RoomStatus.off,
|
|
476
|
+
},
|
|
418
477
|
};
|
|
419
478
|
this.emitMsg(off);
|
|
420
479
|
}
|
|
421
480
|
msg_ROOM_CHANGE(msg) {
|
|
481
|
+
const { data, msg_id, send_time } = msg;
|
|
422
482
|
let change = {
|
|
423
483
|
platform: "bilibili",
|
|
424
484
|
room: this.id,
|
|
425
|
-
type: "
|
|
426
|
-
|
|
485
|
+
type: "live_detail",
|
|
486
|
+
id: msg_id,
|
|
487
|
+
timestamp: send_time,
|
|
427
488
|
info: {
|
|
428
|
-
title:
|
|
429
|
-
area: [
|
|
430
|
-
}
|
|
489
|
+
title: data.title,
|
|
490
|
+
area: [data.parent_area_name, data.area_name],
|
|
491
|
+
},
|
|
431
492
|
};
|
|
432
493
|
this.emitMsg(change);
|
|
433
494
|
}
|
package/src/lib/LiveRoom.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface RoomInfo {
|
|
|
10
10
|
/** 房间key */
|
|
11
11
|
key: string;
|
|
12
12
|
/** 基本信息 */
|
|
13
|
-
|
|
13
|
+
detail: RoomDetail;
|
|
14
14
|
/** 统计信息 */
|
|
15
15
|
stats?: RoomStatsInfo;
|
|
16
16
|
/** 主播信息 */
|
|
@@ -29,7 +29,7 @@ export interface RoomInfo {
|
|
|
29
29
|
connected: boolean;
|
|
30
30
|
}
|
|
31
31
|
/** 房间展示信息 */
|
|
32
|
-
export declare type
|
|
32
|
+
export declare type RoomDetail = {
|
|
33
33
|
/** 直播标题 */
|
|
34
34
|
title?: string;
|
|
35
35
|
/** 分区 */
|
|
@@ -54,8 +54,8 @@ export declare abstract class LiveRoom extends EventEmitter implements RoomInfo
|
|
|
54
54
|
abstract readonly platform: string;
|
|
55
55
|
/** 房间id */
|
|
56
56
|
abstract readonly id: string | number;
|
|
57
|
-
/**
|
|
58
|
-
abstract
|
|
57
|
+
/** 房间详情 */
|
|
58
|
+
abstract detail: RoomDetail;
|
|
59
59
|
/** 统计信息 */
|
|
60
60
|
stats?: RoomStatsInfo;
|
|
61
61
|
/** 主播信息 */
|
package/src/lib/LiveRoom.js
CHANGED
|
@@ -29,12 +29,13 @@ class LiveRoom extends events_1.EventEmitter {
|
|
|
29
29
|
this.timestamp = msg.timestamp;
|
|
30
30
|
this.emit("status", enum_1.RoomStatus.live, { timestamp: msg.timestamp, id: msg.info.id });
|
|
31
31
|
break;
|
|
32
|
-
case "
|
|
33
|
-
this.
|
|
34
|
-
this.emit("
|
|
32
|
+
case "live_detail":
|
|
33
|
+
this.detail = Object.assign(this.detail, msg.info);
|
|
34
|
+
this.emit("detail", msg.info);
|
|
35
35
|
break;
|
|
36
36
|
case "live_stats":
|
|
37
37
|
this.stats = Object.assign(this.stats, msg.info);
|
|
38
|
+
this.emit("stats", msg.info);
|
|
38
39
|
break;
|
|
39
40
|
case "live_end":
|
|
40
41
|
case "live_cut":
|
|
@@ -54,7 +55,7 @@ class LiveRoom extends events_1.EventEmitter {
|
|
|
54
55
|
return {
|
|
55
56
|
platform: this.platform,
|
|
56
57
|
id: this.id,
|
|
57
|
-
|
|
58
|
+
detail: this.detail,
|
|
58
59
|
stats: this.stats,
|
|
59
60
|
anchor: this.anchor,
|
|
60
61
|
timestamp: this.timestamp,
|
package/src/module/Room.js
CHANGED
|
@@ -53,8 +53,8 @@ class RoomController {
|
|
|
53
53
|
this.main.emit("room_info", key, room.info);
|
|
54
54
|
});
|
|
55
55
|
// 直播展示信息更改
|
|
56
|
-
room.on("
|
|
57
|
-
this.main.emit("
|
|
56
|
+
room.on("detail", (data) => {
|
|
57
|
+
this.main.emit("room_detail", key, data);
|
|
58
58
|
});
|
|
59
59
|
// 直播状态更改
|
|
60
60
|
room.on("status", (status, { id, timestamp }) => {
|
package/src/tool.d.ts
ADDED
package/src/tool.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateKey = void 0;
|
|
4
|
+
function generateKey(msg) {
|
|
5
|
+
switch (msg.type) {
|
|
6
|
+
case "gift":
|
|
7
|
+
return `gift:${msg.info.gift.comboId || `${msg.info.user.id}-${msg.timestamp}`}`;
|
|
8
|
+
case "superchat":
|
|
9
|
+
return `superchat:${msg.info.id}`;
|
|
10
|
+
case "membership":
|
|
11
|
+
return `membership:${msg.info.user.id}-${msg.info.level || 0}-${msg.timestamp}`;
|
|
12
|
+
default:
|
|
13
|
+
if (/^live_/.test(msg.type)) {
|
|
14
|
+
return `${msg.type}:${msg.platform}:${msg.room}-${msg.timestamp}`;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return `${msg.type}:${msg.info.user?.id || 0}-${msg.timestamp}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.generateKey = generateKey;
|
|
@@ -55,13 +55,13 @@ export interface GiftInfo {
|
|
|
55
55
|
/** 礼物连击数 */
|
|
56
56
|
combo?: string;
|
|
57
57
|
/** 礼物连击id */
|
|
58
|
-
|
|
58
|
+
comboId?: string;
|
|
59
59
|
/** 人民币价值 */
|
|
60
60
|
cny?: number;
|
|
61
61
|
/** 行为 */
|
|
62
62
|
action?: string;
|
|
63
63
|
/** 随机礼物信息 */
|
|
64
|
-
|
|
64
|
+
blindGift?: GiftInfo;
|
|
65
65
|
/** 图片信息 */
|
|
66
66
|
image?: string;
|
|
67
67
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RoomInfo } from
|
|
2
|
-
import { DanmakuMode, RoomStatus, UserAdmin } from
|
|
3
|
-
import {
|
|
1
|
+
import { RoomInfo } from "./../../lib/LiveRoom";
|
|
2
|
+
import { DanmakuMode, RoomStatus, UserAdmin } from "../../enum";
|
|
3
|
+
import { RoomDetail, RoomStatsInfo } from "../../lib/LiveRoom";
|
|
4
4
|
import { UserInfo, GiftInfo, ImageInfo } from "./AttributeInfo";
|
|
5
5
|
declare type MessageBase = {
|
|
6
6
|
/** 平台名称 */
|
|
@@ -11,6 +11,8 @@ declare type MessageBase = {
|
|
|
11
11
|
type: string;
|
|
12
12
|
/** 时间戳 */
|
|
13
13
|
timestamp: number;
|
|
14
|
+
/** 消息id */
|
|
15
|
+
id: string;
|
|
14
16
|
/** 其他属性 */
|
|
15
17
|
[attr: string]: any;
|
|
16
18
|
};
|
|
@@ -28,7 +30,7 @@ export declare type MessageExt<T extends MessageInterface, E extends {
|
|
|
28
30
|
info: E;
|
|
29
31
|
};
|
|
30
32
|
/** 文本聊天消息 */
|
|
31
|
-
export
|
|
33
|
+
export interface MessageChat extends MessageBase {
|
|
32
34
|
type: "chat";
|
|
33
35
|
info: {
|
|
34
36
|
/** 用户信息 */
|
|
@@ -50,9 +52,9 @@ export declare type MessageChat = MessageBase & {
|
|
|
50
52
|
/** 标签信息 */
|
|
51
53
|
tag?: string;
|
|
52
54
|
};
|
|
53
|
-
}
|
|
55
|
+
}
|
|
54
56
|
/** 礼物消息 */
|
|
55
|
-
export
|
|
57
|
+
export interface MessageGift extends MessageBase {
|
|
56
58
|
type: "gift";
|
|
57
59
|
info: {
|
|
58
60
|
/** 用户信息 */
|
|
@@ -60,9 +62,9 @@ export declare type MessageGift = MessageBase & {
|
|
|
60
62
|
/** 礼物信息 */
|
|
61
63
|
gift: GiftInfo;
|
|
62
64
|
};
|
|
63
|
-
}
|
|
65
|
+
}
|
|
64
66
|
/** 互动消息(进入直播间、点赞、关注、分享、加入粉丝团) */
|
|
65
|
-
export
|
|
67
|
+
export interface MessageInteract extends MessageBase {
|
|
66
68
|
type: "entry" | "like" | "follow" | "share" | "join";
|
|
67
69
|
info: {
|
|
68
70
|
/** 用户信息 */
|
|
@@ -70,9 +72,9 @@ export declare type MessageInteract = MessageBase & {
|
|
|
70
72
|
/** 信息标签 */
|
|
71
73
|
tag?: string | boolean;
|
|
72
74
|
};
|
|
73
|
-
}
|
|
75
|
+
}
|
|
74
76
|
/** 粉丝vip开通消息 */
|
|
75
|
-
export
|
|
77
|
+
export interface MessageMembership extends MessageBase {
|
|
76
78
|
type: "membership";
|
|
77
79
|
info: {
|
|
78
80
|
/** 用户信息 */
|
|
@@ -86,13 +88,13 @@ export declare type MessageMembership = MessageBase & {
|
|
|
86
88
|
/** 持续时间(天数) */
|
|
87
89
|
duration: number;
|
|
88
90
|
};
|
|
89
|
-
}
|
|
91
|
+
}
|
|
90
92
|
/** 粉丝vip开通消息 */
|
|
91
|
-
export
|
|
93
|
+
export interface MessageSuperchat extends MessageBase {
|
|
92
94
|
type: "superchat";
|
|
93
95
|
info: {
|
|
94
96
|
/** 留言id */
|
|
95
|
-
id
|
|
97
|
+
id: string;
|
|
96
98
|
/** 用户信息 */
|
|
97
99
|
user: UserInfo;
|
|
98
100
|
/** 文本内容 */
|
|
@@ -104,9 +106,9 @@ export declare type MessageSuperchat = MessageBase & {
|
|
|
104
106
|
/** (SC)持续时间 */
|
|
105
107
|
duration: number;
|
|
106
108
|
};
|
|
107
|
-
}
|
|
109
|
+
}
|
|
108
110
|
/** 禁言消息 */
|
|
109
|
-
export
|
|
111
|
+
export interface MessageBlock extends MessageBase {
|
|
110
112
|
type: "block";
|
|
111
113
|
info: {
|
|
112
114
|
/** 用户信息 */
|
|
@@ -116,23 +118,23 @@ export declare type MessageBlock = MessageBase & {
|
|
|
116
118
|
admin: null | UserAdmin;
|
|
117
119
|
};
|
|
118
120
|
};
|
|
119
|
-
}
|
|
121
|
+
}
|
|
120
122
|
/** 直播开播消息 */
|
|
121
|
-
export
|
|
123
|
+
export interface MessageLiveStart extends MessageBase {
|
|
122
124
|
type: "live_start";
|
|
123
125
|
info: {
|
|
124
126
|
/** 直播id */
|
|
125
127
|
id: string;
|
|
126
128
|
};
|
|
127
|
-
}
|
|
129
|
+
}
|
|
128
130
|
/** 直播切断消息 */
|
|
129
|
-
export
|
|
131
|
+
export interface MessageLiveCut extends MessageBase {
|
|
130
132
|
type: "live_cut";
|
|
131
133
|
info: {
|
|
132
134
|
/** 切断消息 */
|
|
133
135
|
message: string;
|
|
134
136
|
};
|
|
135
|
-
}
|
|
137
|
+
}
|
|
136
138
|
/** 获取房间信息 */
|
|
137
139
|
export interface MessageRoomInfo extends MessageBase {
|
|
138
140
|
type: "room_info";
|
|
@@ -140,24 +142,24 @@ export interface MessageRoomInfo extends MessageBase {
|
|
|
140
142
|
info: RoomInfo;
|
|
141
143
|
}
|
|
142
144
|
/** 直播数据更新 */
|
|
143
|
-
export
|
|
145
|
+
export interface MessageLiveStats extends MessageBase {
|
|
144
146
|
type: "live_stats";
|
|
145
147
|
info: RoomStatsInfo;
|
|
146
|
-
}
|
|
148
|
+
}
|
|
147
149
|
/** 直播展示信息更新 */
|
|
148
|
-
export
|
|
149
|
-
type: "
|
|
150
|
-
info:
|
|
151
|
-
}
|
|
150
|
+
export interface MessageLiveDetail extends MessageBase {
|
|
151
|
+
type: "live_detail";
|
|
152
|
+
info: RoomDetail;
|
|
153
|
+
}
|
|
152
154
|
/** 直播结束 */
|
|
153
|
-
export
|
|
155
|
+
export interface MessageLiveEnd extends MessageBase {
|
|
154
156
|
type: "live_end";
|
|
155
157
|
info: {
|
|
156
158
|
/** 直播状态 */
|
|
157
159
|
status: RoomStatus;
|
|
158
160
|
};
|
|
159
|
-
}
|
|
160
|
-
declare type AllMessageType = MessageChat | MessageGift | MessageInteract | MessageMembership | MessageSuperchat | MessageBlock | MessageLiveStart | MessageLiveEnd | MessageLiveCut |
|
|
161
|
+
}
|
|
162
|
+
declare type AllMessageType = MessageChat | MessageGift | MessageInteract | MessageMembership | MessageSuperchat | MessageBlock | MessageLiveStart | MessageLiveEnd | MessageLiveCut | MessageLiveDetail | MessageLiveStats;
|
|
161
163
|
export declare type MessageData<T extends AllMessageType["type"] = AllMessageType["type"]> = AllMessageType & {
|
|
162
164
|
type: T;
|
|
163
165
|
};
|