@polyv/chat 2.2.0-rc-20251113.1 → 2.3.0-rc-20251204.1

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.es.d.ts CHANGED
@@ -4,6 +4,42 @@ import { EventEmitter } from '@polyv/utils/es/event';
4
4
  import { PolyvSocket } from '@polyv/socket';
5
5
  import { SocketUserType } from '@polyv/socket';
6
6
 
7
+ declare class AskModule extends ChatModuleBase {
8
+ private __apiFilter;
9
+ constructor(plvChat: PolyvChat);
10
+ private __handleAskSocket;
11
+ /**
12
+ * 获取提问用户列表
13
+ */
14
+ getAskUserList(): Promise<AskUser[]>;
15
+ /**
16
+ * 获取提问历史消息
17
+ */
18
+ getAskHistory(options: GetAskHistoryOptions): Promise<AskMsgType[]>;
19
+ private __buildSocketData;
20
+ sendSpeakMsg(options: SendAskSpeakMsgOptions): Promise<void>;
21
+ sendImageMsg(options: SendAskImageMsgOptions): Promise<void>;
22
+ sendSystemMsg(options: SendAskSystemMsgOptions): Promise<void>;
23
+ }
24
+
25
+ /**
26
+ * 提问消息类型
27
+ */
28
+ export declare type AskMsgType = ChatMsgSpeakType | ChatMsgImageType | ChatMsgSystemType;
29
+
30
+ export declare interface AskUser {
31
+ /** 用户 id */
32
+ userId: string;
33
+ /** 昵称 */
34
+ nick: string;
35
+ /** 头像 */
36
+ pic: string;
37
+ /** 头衔 */
38
+ actor: string;
39
+ /** 最新消息的时间戳 */
40
+ lastMessageTime: number;
41
+ }
42
+
7
43
  export declare interface AttendanceData extends ChatMessageUser {
8
44
  /**
9
45
  * 排序号
@@ -140,7 +176,7 @@ export declare interface ChatMessageUser<T extends SocketUserType = SocketUserTy
140
176
  */
141
177
  label?: {
142
178
  /** 提问区标签 */
143
- question: string[];
179
+ question?: string[];
144
180
  };
145
181
  }
146
182
 
@@ -776,6 +812,13 @@ declare class FilterBase {
776
812
  _filterUser(user: ChatMessageUser): ChatMessageUser;
777
813
  }
778
814
 
815
+ export declare interface GetAskHistoryOptions {
816
+ /**
817
+ * 目标用户 id
818
+ */
819
+ targetUserId: string;
820
+ }
821
+
779
822
  export declare interface GetAttendanceDownloadRecordOptions {
780
823
  pageNumber?: number;
781
824
  pageSize?: number;
@@ -1215,6 +1258,13 @@ declare class OnlineModule extends ChatModuleBase {
1215
1258
  * @param options 获取选项
1216
1259
  */
1217
1260
  getOnlineList(options?: GetOnlineListOptions): Promise<OnlineListResult>;
1261
+ /**
1262
+ * 获取在线列表(观众)
1263
+ */
1264
+ private __getOnlineListByViewer;
1265
+ /**
1266
+ * 获取在线列表(搜索)
1267
+ */
1218
1268
  private __getOnlineListByKeyword;
1219
1269
  /**
1220
1270
  * 获取在线列表(普通)
@@ -1296,7 +1346,7 @@ export declare class PolyvChat {
1296
1346
  status: StatusModule;
1297
1347
  /** 工具模块 */
1298
1348
  utils: UtilsModule;
1299
- /** 发送模块 */
1349
+ /** 聊天消息发送模块 */
1300
1350
  sender: SenderModule;
1301
1351
  /** 管理模块 */
1302
1352
  manage: ManageModule;
@@ -1306,6 +1356,8 @@ export declare class PolyvChat {
1306
1356
  download: DownloadModule;
1307
1357
  /** 点赞模块 */
1308
1358
  like: LikeModule;
1359
+ /** 提问模块 */
1360
+ ask: AskModule;
1309
1361
  constructor(plvSocket: PolyvSocket, config?: PolyvChatConfig);
1310
1362
  /** 是否设置完成 */
1311
1363
  setuped: boolean;
@@ -1346,6 +1398,10 @@ export declare enum PolyvChatEvent {
1346
1398
  * 用户登录事件
1347
1399
  */
1348
1400
  UserLogin = "UserLogin",
1401
+ /**
1402
+ * 用户退出事件
1403
+ */
1404
+ UserLogout = "UserLogout",
1349
1405
  /**
1350
1406
  * 聊天消息事件
1351
1407
  */
@@ -1429,7 +1485,11 @@ export declare enum PolyvChatEvent {
1429
1485
  /**
1430
1486
  * 发送点赞
1431
1487
  */
1432
- SendChatLike = "SendChatLike"
1488
+ SendChatLike = "SendChatLike",
1489
+ /**
1490
+ * 提问消息事件
1491
+ */
1492
+ AskMessage = "AskMessage"
1433
1493
  }
1434
1494
 
1435
1495
  export declare type PolyvChatEventRelations = {
@@ -1445,6 +1505,16 @@ export declare type PolyvChatEventRelations = {
1445
1505
  */
1446
1506
  user: ChatMessageUser;
1447
1507
  };
1508
+ [PolyvChatEvent.UserLogout]: {
1509
+ /**
1510
+ * 用户 id
1511
+ */
1512
+ userId: string;
1513
+ /**
1514
+ * 用户昵称
1515
+ */
1516
+ nick: string;
1517
+ };
1448
1518
  [PolyvChatEvent.ChatMessage]: {
1449
1519
  /**
1450
1520
  * 聊天消息对象
@@ -1605,6 +1675,16 @@ export declare type PolyvChatEventRelations = {
1605
1675
  */
1606
1676
  count: number;
1607
1677
  };
1678
+ [PolyvChatEvent.AskMessage]: {
1679
+ /**
1680
+ * 提问消息
1681
+ */
1682
+ askMsg: AskMsgType;
1683
+ /**
1684
+ * 目标用户 id
1685
+ */
1686
+ targetUserId: string;
1687
+ };
1608
1688
  };
1609
1689
 
1610
1690
  export declare interface PushMsgToQaOptions {
@@ -1682,6 +1762,54 @@ export declare interface ResultSuccessBasic {
1682
1762
  success: true;
1683
1763
  }
1684
1764
 
1765
+ export declare interface SendAskImageMsgOptions {
1766
+ /**
1767
+ * 图片 id
1768
+ */
1769
+ imageId: string;
1770
+ /**
1771
+ * 图片地址
1772
+ */
1773
+ imageUrl: string;
1774
+ /**
1775
+ * 图片尺寸
1776
+ */
1777
+ size?: {
1778
+ width: number;
1779
+ height: number;
1780
+ };
1781
+ /**
1782
+ * 目标用户 id
1783
+ */
1784
+ targetUserId?: string;
1785
+ }
1786
+
1787
+ export declare interface SendAskSpeakMsgOptions {
1788
+ /**
1789
+ * 发言内容
1790
+ */
1791
+ content: string;
1792
+ /**
1793
+ * 目标用户 id
1794
+ */
1795
+ targetUserId?: string;
1796
+ }
1797
+
1798
+ export declare interface SendAskSystemMsgOptions {
1799
+ /**
1800
+ * 系统消息类型
1801
+ */
1802
+ type?: SystemMsgType;
1803
+ /**
1804
+ * 消息内容
1805
+ */
1806
+ content: string;
1807
+ /**
1808
+ * 目标用户 id
1809
+ */
1810
+ targetUserId: string;
1811
+ }
1812
+
1685
1813
  export declare interface SendCustomServerMsgOptions {
1686
1814
  /**
1687
1815
  * 自定义消息内容
@@ -1907,7 +2035,11 @@ export declare enum SystemMsgType {
1907
2035
  /**
1908
2036
  * 聊天区通知
1909
2037
  */
1910
- ChatRoomIntroduction = "chat-room-introduction"
2038
+ ChatRoomIntroduction = "chat-room-introduction",
2039
+ /**
2040
+ * 违规词
2041
+ */
2042
+ ForbiddenWord = "forbidden-word"
1911
2043
  }
1912
2044
 
1913
2045
  export declare interface TopingMsgData {