floating-live 0.17.0-alpha.14 → 0.17.0-alpha.15

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.
@@ -29,7 +29,7 @@ export declare namespace LiveMessage {
29
29
  /** 聊天消息 */
30
30
  interface Comment extends Base {
31
31
  type: "comment";
32
- info: {
32
+ data: {
33
33
  /** 用户信息 */
34
34
  user: UserInfo;
35
35
  /** 文本内容 */
@@ -53,7 +53,7 @@ export declare namespace LiveMessage {
53
53
  /** 礼物消息 */
54
54
  interface Gift extends Base {
55
55
  type: "gift";
56
- info: {
56
+ data: {
57
57
  /** 用户信息 */
58
58
  user: UserInfo;
59
59
  /** 礼物信息 */
@@ -63,7 +63,7 @@ export declare namespace LiveMessage {
63
63
  /** 互动消息(进入直播间、点赞、关注、分享、加入粉丝团) */
64
64
  interface Interact extends Base {
65
65
  type: "entry" | "like" | "follow" | "share" | "join";
66
- info: {
66
+ data: {
67
67
  /** 用户信息 */
68
68
  user: UserInfo;
69
69
  /** 信息标签 */
@@ -73,7 +73,7 @@ export declare namespace LiveMessage {
73
73
  /** 粉丝vip开通消息 */
74
74
  interface Membership extends Base {
75
75
  type: "membership";
76
- info: {
76
+ data: {
77
77
  /** 用户信息 */
78
78
  user: UserInfo;
79
79
  /** 礼物信息 */
@@ -86,10 +86,10 @@ export declare namespace LiveMessage {
86
86
  duration: number;
87
87
  };
88
88
  }
89
- /** 粉丝vip开通消息 */
89
+ /** 付费留言消息 */
90
90
  interface Superchat extends Base {
91
91
  type: "superchat";
92
- info: {
92
+ data: {
93
93
  /** 留言代码,用于撤回消息 */
94
94
  token: string | number;
95
95
  /** 用户信息 */
@@ -104,10 +104,17 @@ export declare namespace LiveMessage {
104
104
  duration: number;
105
105
  };
106
106
  }
107
+ /** 付费留言删除消息 */
108
+ interface SuperchatDelete extends Base {
109
+ type: "superchat_delete";
110
+ data: {
111
+ token: string;
112
+ };
113
+ }
107
114
  /** 禁言消息 */
108
115
  interface Block extends Base {
109
116
  type: "block";
110
- info: {
117
+ data: {
111
118
  /** 用户信息 */
112
119
  user: UserInfo;
113
120
  /** 操作者 */
@@ -119,7 +126,7 @@ export declare namespace LiveMessage {
119
126
  /** 直播开播消息 */
120
127
  interface LiveStart extends Base {
121
128
  type: "live_start";
122
- info: {
129
+ data: {
123
130
  /** 直播id */
124
131
  id: string;
125
132
  };
@@ -127,7 +134,7 @@ export declare namespace LiveMessage {
127
134
  /** 直播结束 */
128
135
  interface LiveEnd extends Base {
129
136
  type: "live_end";
130
- info: {
137
+ data: {
131
138
  /** 直播状态 */
132
139
  status: LiveRoomStatus;
133
140
  };
@@ -135,7 +142,7 @@ export declare namespace LiveMessage {
135
142
  /** 直播切断消息 */
136
143
  interface LiveCut extends Base {
137
144
  type: "live_cut";
138
- info: {
145
+ data: {
139
146
  /** 切断消息 */
140
147
  message: string;
141
148
  status: LiveRoomStatus;
@@ -144,12 +151,12 @@ export declare namespace LiveMessage {
144
151
  /** 直播数据更新 */
145
152
  interface LiveStats extends Base {
146
153
  type: "live_stats";
147
- info: LiveRoomStatsInfo;
154
+ data: LiveRoomStatsInfo;
148
155
  }
149
156
  /** 直播展示信息更新 */
150
157
  interface LiveDetail extends Base {
151
158
  type: "live_detail";
152
- info: LiveRoomDetailInfo;
159
+ data: LiveRoomDetailInfo;
153
160
  }
154
161
  type All = Comment | Gift | Interact | Membership | Superchat | Block | LiveStart | LiveEnd | LiveCut | LiveDetail | LiveStats;
155
162
  }
@@ -50,20 +50,20 @@ export interface GiftInfo {
50
50
  num: number;
51
51
  /** 礼物价值(总价,按平台货币计算) */
52
52
  value?: number;
53
- /** 显示的礼物价值 */
54
- displayValue?: number;
55
53
  /** 平台货币类型 */
56
- coinType?: string | number;
54
+ valueType?: string | number;
55
+ /** 显示的平台货币数量 */
56
+ coins?: number;
57
57
  /** 平台货币名称 */
58
58
  coinName?: string;
59
- /** 礼物连击数 */
60
- combo?: number;
61
- /** 礼物连击id */
62
- comboId?: string;
63
59
  /** 礼物金额(总价,按消费现金计算) */
64
60
  price?: number;
65
61
  /** 礼物金额货币 */
66
62
  currency?: string;
63
+ /** 礼物连击数 */
64
+ combo?: number;
65
+ /** 礼物连击id */
66
+ comboId?: string;
67
67
  /** 行为 */
68
68
  action?: string;
69
69
  /** 随机礼物信息 */
@@ -7,11 +7,10 @@ export declare abstract class LiveRoom extends CustomEventEmitter implements Liv
7
7
  constructor();
8
8
  get valid(): true;
9
9
  get pending(): false;
10
- get service(): string;
11
10
  /** 平台 */
12
11
  abstract readonly platform: string;
13
- /** 服务分支 */
14
- readonly serviceBranch: string;
12
+ /** 服务id */
13
+ abstract readonly service: string;
15
14
  /** 房间id */
16
15
  abstract readonly id: string | number;
17
16
  /** 房间详情 */
@@ -61,14 +60,13 @@ export declare abstract class LiveRoom extends CustomEventEmitter implements Liv
61
60
  /** 无效房间 */
62
61
  export declare class InvalidLiveRoom implements LiveRoomData {
63
62
  get valid(): false;
64
- get service(): string;
65
63
  constructor(service: string, id: string | number, { pending, error }?: {
66
64
  pending?: boolean | undefined;
67
65
  error?: null | undefined;
68
66
  });
69
67
  readonly platform: string;
68
+ readonly service: string;
70
69
  readonly id: string | number;
71
- readonly serviceBranch: string;
72
70
  pending: boolean;
73
71
  detail: LiveRoomDetailInfo;
74
72
  stats?: LiveRoomStatsInfo;
@@ -103,12 +101,10 @@ export interface LiveRoomData {
103
101
  pending?: boolean;
104
102
  /** 平台id */
105
103
  platform: string;
106
- /** 服务分支 */
107
- serviceBranch: string;
104
+ /** 服务id */
105
+ service: string;
108
106
  /** 房间id */
109
107
  id: number | string;
110
- /** API服务id */
111
- service: string;
112
108
  /** 房间key */
113
109
  key: string;
114
110
  /** 基本信息 */
@@ -156,6 +152,10 @@ export interface LiveRoomStatsInfo {
156
152
  online?: number;
157
153
  /** 人气值 */
158
154
  popularity?: number;
155
+ /** 粉丝数 */
156
+ fans?: number;
157
+ /** 粉丝团人数 */
158
+ clubFans?: number;
159
159
  }
160
160
  /** 直播间状态 */
161
161
  export declare const LiveRoomStatus: {
package/dist/live/room.js CHANGED
@@ -10,13 +10,6 @@ export class LiveRoom extends CustomEventEmitter {
10
10
  get pending() {
11
11
  return false;
12
12
  }
13
- get service() {
14
- return this.serviceBranch
15
- ? `${this.platform}.${this.serviceBranch}`
16
- : this.platform;
17
- }
18
- /** 服务分支 */
19
- serviceBranch = "";
20
13
  /** 统计信息 */
21
14
  stats;
22
15
  /** 直播状态 */
@@ -53,24 +46,24 @@ export class LiveRoom extends CustomEventEmitter {
53
46
  this.emit("status", {
54
47
  status: LiveRoomStatus.live,
55
48
  timestamp: msg.timestamp,
56
- liveId: msg.info.id,
49
+ liveId: msg.data.id,
57
50
  });
58
51
  break;
59
52
  case "live_detail":
60
- this.detail = Object.assign(this.detail, msg.info);
61
- this.emit("detail", { detail: msg.info });
53
+ this.detail = Object.assign(this.detail, msg.data);
54
+ this.emit("detail", { detail: msg.data });
62
55
  break;
63
56
  case "live_stats":
64
- this.stats = Object.assign(this.stats, msg.info);
65
- this.emit("stats", { stats: msg.info });
57
+ this.stats = Object.assign(this.stats, msg.data);
58
+ this.emit("stats", { stats: msg.data });
66
59
  break;
67
60
  case "live_end":
68
61
  case "live_cut":
69
- this.status = msg.info.status || LiveRoomStatus.off;
62
+ this.status = msg.data.status || LiveRoomStatus.off;
70
63
  this.timestamp = msg.timestamp;
71
64
  this.emit("message", { message: msg });
72
65
  this.emit("status", {
73
- status: msg.info.status || LiveRoomStatus.off,
66
+ status: msg.data.status || LiveRoomStatus.off,
74
67
  timestamp: msg.timestamp,
75
68
  liveId: this.liveId,
76
69
  });
@@ -88,7 +81,6 @@ export class LiveRoom extends CustomEventEmitter {
88
81
  valid: this.valid,
89
82
  pending: this.pending,
90
83
  platform: this.platform,
91
- serviceBranch: this.serviceBranch,
92
84
  id: this.id,
93
85
  detail: this.detail,
94
86
  stats: this.stats,
@@ -113,22 +105,17 @@ export class InvalidLiveRoom {
113
105
  get valid() {
114
106
  return false;
115
107
  }
116
- get service() {
117
- return this.serviceBranch
118
- ? `${this.platform}.${this.serviceBranch}`
119
- : this.platform;
120
- }
121
108
  constructor(service, id, { pending = false, error = null } = {}) {
122
- const [platform, ...serviceIdArr] = service.split(".");
109
+ const [platform] = service.split(".");
123
110
  this.platform = platform;
124
111
  this.id = id;
125
- this.serviceBranch = serviceIdArr.join(".");
112
+ this.service = service;
126
113
  this.pending = pending;
127
114
  this.error = error;
128
115
  }
129
116
  platform;
117
+ service;
130
118
  id;
131
- serviceBranch;
132
119
  pending;
133
120
  detail = {};
134
121
  stats;
@@ -149,7 +136,7 @@ export class InvalidLiveRoom {
149
136
  valid: this.valid,
150
137
  pending: this.pending,
151
138
  platform: this.platform,
152
- serviceBranch: this.serviceBranch,
139
+ service: this.service,
153
140
  id: this.id,
154
141
  detail: this.detail,
155
142
  stats: this.stats,
@@ -161,7 +148,6 @@ export class InvalidLiveRoom {
161
148
  opened: this.opened,
162
149
  available: this.available,
163
150
  connectionStatus: this.connectionStatus,
164
- service: this.service,
165
151
  key: this.key,
166
152
  };
167
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.17.0-alpha.14",
3
+ "version": "0.17.0-alpha.15",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",