floating-live 0.12.1 → 0.13.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/README.md +7 -8
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +4 -2
- package/plugin/acfun/acfunLive.d.ts +3 -3
- package/plugin/acfun/acfunLive.js +6 -6
- package/plugin/acfun/index.d.ts +1 -0
- package/plugin/acfun/index.js +3 -2
- package/plugin/bilibili/index.d.ts +1 -0
- package/plugin/bilibili/index.js +17 -4
- package/plugin/bilibili/parser.d.ts +6 -0
- package/plugin/bilibili/{bilibiliLive.js → parser.js} +116 -229
- package/plugin/bilibili/room.d.ts +77 -0
- package/plugin/bilibili/room.js +261 -0
- package/plugin/bilibili/types.d.ts +424 -0
- package/plugin/bilibili/utils.d.ts +16 -0
- package/plugin/bilibili/utils.js +140 -0
- package/plugin/chatPrint/chatPrint.d.ts +2 -2
- package/plugin/chatPrint/chatPrint.js +3 -3
- package/plugin/chatPrint/index.d.ts +1 -0
- package/plugin/chatPrint/index.js +2 -1
- package/plugin/consoleEvent/index.d.ts +1 -0
- package/plugin/consoleEvent/index.js +16 -21
- package/plugin/msgSave/index.d.ts +3 -1
- package/plugin/msgSave/index.js +25 -30
- package/plugin/msgSave/msgSave.d.ts +5 -5
- package/plugin/msgSave/msgSave.js +25 -9
- package/src/abstract/LiveRoom.d.ts +44 -0
- package/src/{lib → abstract}/LiveRoom.js +12 -7
- package/src/index.d.ts +13 -37
- package/src/index.js +12 -74
- package/src/module/ModAuth.d.ts +8 -0
- package/src/module/ModAuth.js +14 -0
- package/src/module/ModCommand.d.ts +3 -0
- package/src/module/ModCommand.js +6 -0
- package/src/module/ModMessage.d.ts +9 -0
- package/src/module/ModMessage.js +12 -0
- package/src/module/{Plugin.d.ts → ModPlugin.d.ts} +2 -6
- package/src/module/{Plugin.js → ModPlugin.js} +20 -18
- package/src/module/ModRooms.d.ts +36 -0
- package/src/module/{Room.js → ModRooms.js} +50 -31
- package/src/types/index.d.ts +1 -2
- package/src/types/index.js +1 -2
- package/src/types/message.d.ts +210 -0
- package/src/types/plugin.d.ts +4 -5
- package/src/types/room.d.ts +48 -2
- package/src/utils.d.ts +2 -2
- package/test/type/bilibili_getInfoByRoom.d.ts +492 -0
- package/plugin/bilibili/bilibiliLive.d.ts +0 -58
- package/src/lib/LiveRoom.d.ts +0 -89
- package/src/module/Command.d.ts +0 -3
- package/src/module/Command.js +0 -6
- package/src/module/Room.d.ts +0 -26
- package/src/types/message/AttributeInfo.d.ts +0 -67
- package/src/types/message/MessageData.d.ts +0 -167
- /package/{src/types/message/AttributeInfo.js → plugin/bilibili/types.js} +0 -0
- /package/src/{lib → abstract}/Reglist.d.ts +0 -0
- /package/src/{lib → abstract}/Reglist.js +0 -0
- /package/src/types/{message/MessageData.js → message.js} +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { ImageSize, UserType } from "../enum";
|
|
2
|
+
import { DanmakuMode, RoomStatus } from "../enum";
|
|
3
|
+
import { RoomDetail, RoomStatsInfo } from "./room";
|
|
4
|
+
export declare namespace Message {
|
|
5
|
+
interface Base {
|
|
6
|
+
/** 平台名称 */
|
|
7
|
+
platform: string;
|
|
8
|
+
/** 房间号 */
|
|
9
|
+
room: number | string;
|
|
10
|
+
/** 信息类型 */
|
|
11
|
+
type: string;
|
|
12
|
+
/** 时间戳 */
|
|
13
|
+
timestamp: number;
|
|
14
|
+
/** 消息id */
|
|
15
|
+
id: string;
|
|
16
|
+
/** 其他属性 */
|
|
17
|
+
[attr: string]: any;
|
|
18
|
+
}
|
|
19
|
+
/** 文本聊天消息 */
|
|
20
|
+
interface Chat extends Base {
|
|
21
|
+
type: "chat";
|
|
22
|
+
info: {
|
|
23
|
+
/** 用户信息 */
|
|
24
|
+
user: UserInfo;
|
|
25
|
+
/** 文本内容 */
|
|
26
|
+
content: string;
|
|
27
|
+
/** 文字颜色 */
|
|
28
|
+
color?: number | string;
|
|
29
|
+
/** 弹幕模式 */
|
|
30
|
+
mode?: DanmakuMode;
|
|
31
|
+
/** 文字大小 */
|
|
32
|
+
size?: number | string;
|
|
33
|
+
/** 图片信息 */
|
|
34
|
+
image?: ImageInfo;
|
|
35
|
+
/** 表情信息 */
|
|
36
|
+
emoticon?: {
|
|
37
|
+
[keyword: string]: ImageInfo;
|
|
38
|
+
};
|
|
39
|
+
/** 标签信息 */
|
|
40
|
+
tag?: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** 礼物消息 */
|
|
44
|
+
interface Gift extends Base {
|
|
45
|
+
type: "gift";
|
|
46
|
+
info: {
|
|
47
|
+
/** 用户信息 */
|
|
48
|
+
user: UserInfo;
|
|
49
|
+
/** 礼物信息 */
|
|
50
|
+
gift: GiftInfo;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** 互动消息(进入直播间、点赞、关注、分享、加入粉丝团) */
|
|
54
|
+
interface Interact extends Base {
|
|
55
|
+
type: "entry" | "like" | "follow" | "share" | "join";
|
|
56
|
+
info: {
|
|
57
|
+
/** 用户信息 */
|
|
58
|
+
user: UserInfo;
|
|
59
|
+
/** 信息标签 */
|
|
60
|
+
tag?: string | boolean;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** 粉丝vip开通消息 */
|
|
64
|
+
interface Membership extends Base {
|
|
65
|
+
type: "membership";
|
|
66
|
+
info: {
|
|
67
|
+
/** 用户信息 */
|
|
68
|
+
user: UserInfo;
|
|
69
|
+
/** 礼物信息 */
|
|
70
|
+
gift: GiftInfo;
|
|
71
|
+
/** 开通vip名称 */
|
|
72
|
+
name: string;
|
|
73
|
+
/** 开通vip等级 */
|
|
74
|
+
level?: number;
|
|
75
|
+
/** 持续时间(天数) */
|
|
76
|
+
duration: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** 粉丝vip开通消息 */
|
|
80
|
+
interface Superchat extends Base {
|
|
81
|
+
type: "superchat";
|
|
82
|
+
info: {
|
|
83
|
+
/** 留言id */
|
|
84
|
+
id: string;
|
|
85
|
+
/** 用户信息 */
|
|
86
|
+
user: UserInfo;
|
|
87
|
+
/** 文本内容 */
|
|
88
|
+
content: string;
|
|
89
|
+
/** 文字颜色 */
|
|
90
|
+
color?: number | string;
|
|
91
|
+
/** 礼物信息 */
|
|
92
|
+
gift: GiftInfo;
|
|
93
|
+
/** (SC)持续时间 */
|
|
94
|
+
duration: number;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** 禁言消息 */
|
|
98
|
+
interface Block extends Base {
|
|
99
|
+
type: "block";
|
|
100
|
+
info: {
|
|
101
|
+
/** 用户信息 */
|
|
102
|
+
user: UserInfo;
|
|
103
|
+
/** 操作者 */
|
|
104
|
+
operator: UserInfo | {
|
|
105
|
+
type: null | UserType;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** 直播开播消息 */
|
|
110
|
+
interface LiveStart extends Base {
|
|
111
|
+
type: "live_start";
|
|
112
|
+
info: {
|
|
113
|
+
/** 直播id */
|
|
114
|
+
id: string;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/** 直播结束 */
|
|
118
|
+
interface LiveEnd extends Base {
|
|
119
|
+
type: "live_end";
|
|
120
|
+
info: {
|
|
121
|
+
/** 直播状态 */
|
|
122
|
+
status: RoomStatus;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** 直播切断消息 */
|
|
126
|
+
interface LiveCut extends Base {
|
|
127
|
+
type: "live_cut";
|
|
128
|
+
info: {
|
|
129
|
+
/** 切断消息 */
|
|
130
|
+
message: string;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** 直播数据更新 */
|
|
134
|
+
interface LiveStats extends Base {
|
|
135
|
+
type: "live_stats";
|
|
136
|
+
info: RoomStatsInfo;
|
|
137
|
+
}
|
|
138
|
+
/** 直播展示信息更新 */
|
|
139
|
+
interface LiveDetail extends Base {
|
|
140
|
+
type: "live_detail";
|
|
141
|
+
info: RoomDetail;
|
|
142
|
+
}
|
|
143
|
+
type All = Chat | Gift | Interact | Membership | Superchat | Block | LiveStart | LiveEnd | LiveCut | LiveDetail | LiveStats;
|
|
144
|
+
}
|
|
145
|
+
/** 用户信息 */
|
|
146
|
+
export interface UserInfo {
|
|
147
|
+
/** 用户名 */
|
|
148
|
+
name: string;
|
|
149
|
+
/** 用户id */
|
|
150
|
+
id: number;
|
|
151
|
+
/** 头像url */
|
|
152
|
+
avatar?: string;
|
|
153
|
+
/** 粉丝勋章 */
|
|
154
|
+
medal?: MedalInfo | null;
|
|
155
|
+
/** 用户类型 */
|
|
156
|
+
type?: UserType | null;
|
|
157
|
+
/** 粉丝vip等级 */
|
|
158
|
+
membership?: boolean | number;
|
|
159
|
+
/** vip等级 */
|
|
160
|
+
vip?: boolean | number;
|
|
161
|
+
/** 用户等级 */
|
|
162
|
+
level?: number;
|
|
163
|
+
}
|
|
164
|
+
/** 粉丝牌信息 */
|
|
165
|
+
export interface MedalInfo {
|
|
166
|
+
/** 粉丝牌名称 */
|
|
167
|
+
name: string;
|
|
168
|
+
/** 粉丝牌id */
|
|
169
|
+
id: number;
|
|
170
|
+
/** 粉丝牌等级 */
|
|
171
|
+
level?: number;
|
|
172
|
+
/** 粉丝vip等级 */
|
|
173
|
+
membership?: number;
|
|
174
|
+
}
|
|
175
|
+
/** 图像信息 */
|
|
176
|
+
export interface ImageInfo {
|
|
177
|
+
/** 图像名称 */
|
|
178
|
+
name?: string;
|
|
179
|
+
/** 图像id */
|
|
180
|
+
id?: string | number;
|
|
181
|
+
/** 图像url */
|
|
182
|
+
url?: string;
|
|
183
|
+
/** 图像尺寸 */
|
|
184
|
+
size?: ImageSize;
|
|
185
|
+
}
|
|
186
|
+
/** 礼物信息 */
|
|
187
|
+
export interface GiftInfo {
|
|
188
|
+
/** 礼物名称 */
|
|
189
|
+
name: string;
|
|
190
|
+
/** 礼物id */
|
|
191
|
+
id: number | string;
|
|
192
|
+
/** 礼物数量 */
|
|
193
|
+
num: number;
|
|
194
|
+
/** 总价值 */
|
|
195
|
+
value: number;
|
|
196
|
+
/** 平台货币 */
|
|
197
|
+
currency: string;
|
|
198
|
+
/** 礼物连击数 */
|
|
199
|
+
combo?: string;
|
|
200
|
+
/** 礼物连击id */
|
|
201
|
+
comboId?: string;
|
|
202
|
+
/** 人民币价值 */
|
|
203
|
+
cny?: number;
|
|
204
|
+
/** 行为 */
|
|
205
|
+
action?: string;
|
|
206
|
+
/** 随机礼物信息 */
|
|
207
|
+
blindGift?: GiftInfo;
|
|
208
|
+
/** 图片信息 */
|
|
209
|
+
image?: string;
|
|
210
|
+
}
|
package/src/types/plugin.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FloatingLive } from "..";
|
|
2
2
|
/** 插件模块, 加载时调用 */
|
|
3
3
|
export declare type FloatingLivePlugin<T extends FloatingLive> = () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} | void;
|
|
4
|
+
/** 插件名称 */
|
|
5
|
+
name: string;
|
|
6
|
+
register: (ctx: T) => object | void;
|
|
7
|
+
destroy?: (ctx: T) => void;
|
|
9
8
|
};
|
package/src/types/room.d.ts
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
import { RoomStatus } from "../enum";
|
|
2
|
+
import { UserInfo } from "./message";
|
|
3
|
+
export interface RoomInfo {
|
|
4
|
+
/** 平台id */
|
|
5
|
+
platform: string;
|
|
6
|
+
/** 房间id */
|
|
7
|
+
id: number | string;
|
|
8
|
+
/** 房间key */
|
|
9
|
+
key: string;
|
|
10
|
+
/** 基本信息 */
|
|
11
|
+
detail: RoomDetail;
|
|
12
|
+
/** 统计信息 */
|
|
13
|
+
stats?: RoomStatsInfo;
|
|
14
|
+
/** 主播信息 */
|
|
15
|
+
anchor: UserInfo;
|
|
16
|
+
/** 时间戳 */
|
|
17
|
+
timestamp: number;
|
|
18
|
+
/** 当前直播id */
|
|
19
|
+
liveId?: string;
|
|
20
|
+
/** 直播状态 */
|
|
21
|
+
status: RoomStatus;
|
|
22
|
+
/** 直播间是否可用 */
|
|
23
|
+
available: boolean;
|
|
24
|
+
/** 房间监听是否打开 */
|
|
25
|
+
opened: boolean;
|
|
26
|
+
/** 是否连接到房间 */
|
|
27
|
+
connected: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** 房间展示信息 */
|
|
30
|
+
export declare type RoomDetail = {
|
|
31
|
+
/** 直播标题 */
|
|
32
|
+
title?: string;
|
|
33
|
+
/** 分区 */
|
|
34
|
+
area?: string[];
|
|
35
|
+
/** 封面 */
|
|
36
|
+
cover?: string;
|
|
37
|
+
};
|
|
38
|
+
/** 房间统计数据信息 */
|
|
39
|
+
export declare type RoomStatsInfo = {
|
|
40
|
+
/** 点赞数 */
|
|
41
|
+
like?: number;
|
|
42
|
+
/** 观看数 */
|
|
43
|
+
watch?: number;
|
|
44
|
+
/** 在线人数 */
|
|
45
|
+
online?: number;
|
|
46
|
+
/** 人气值 */
|
|
47
|
+
popularity?: number;
|
|
48
|
+
};
|
|
1
49
|
export interface PlatformInfo {
|
|
2
50
|
/** 平台名称 */
|
|
3
51
|
name: string;
|
|
@@ -36,5 +84,3 @@ export interface PlatformInfo {
|
|
|
36
84
|
}>;
|
|
37
85
|
};
|
|
38
86
|
}
|
|
39
|
-
export interface RoomConfig {
|
|
40
|
-
}
|
package/src/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function generateId(msg:
|
|
1
|
+
import { Message } from "./types/message";
|
|
2
|
+
export declare function generateId(msg: Message.All): string;
|