@polyv/chat 2.1.0-rc-20251023.2 → 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
 
@@ -346,6 +382,10 @@ export declare interface ChatMsgRewardType extends ChatMsgCommonType<ChatMsgSour
346
382
  * 打赏礼物图片
347
383
  */
348
384
  gimg: string;
385
+ /**
386
+ * 特效文件
387
+ */
388
+ dynamicFile?: string;
349
389
  /**
350
390
  * 打赏数量
351
391
  */
@@ -657,6 +697,10 @@ declare class DownloadModule extends ChatModuleBase {
657
697
  * 获取到勤/缺勤导出记录
658
698
  */
659
699
  getAttendanceDownloadRecord(options?: GetAttendanceDownloadRecordOptions): Promise<PageContent<DataExportRecordData>>;
700
+ /**
701
+ * 获取导出请求参数
702
+ */
703
+ private __getExportParams;
660
704
  /**
661
705
  * 导出在线列表
662
706
  */
@@ -687,10 +731,15 @@ export declare interface EmotionImageData {
687
731
 
688
732
  declare class EmotionModule extends ChatModuleBase {
689
733
  private __emotionParser?;
734
+ private __emotionParserPromise?;
690
735
  /**
691
736
  * 加载表情解析器
692
737
  */
693
738
  setupEmotionParser(): Promise<void>;
739
+ /**
740
+ * 获取表情解析器
741
+ */
742
+ getEmotionParser(): EmotionParser | undefined;
694
743
  /**
695
744
  * 获取黄脸表情节点
696
745
  *
@@ -747,10 +796,6 @@ declare class EmotionModule extends ChatModuleBase {
747
796
  * ```
748
797
  */
749
798
  translateEmotions(content: string, isZhCN?: boolean): string;
750
- /**
751
- * 获取表情解析器
752
- */
753
- getEmotionParser(): EmotionParser | undefined;
754
799
  private __getEmotionImagePromise?;
755
800
  /**
756
801
  * 获取表情图片列表
@@ -767,6 +812,13 @@ declare class FilterBase {
767
812
  _filterUser(user: ChatMessageUser): ChatMessageUser;
768
813
  }
769
814
 
815
+ export declare interface GetAskHistoryOptions {
816
+ /**
817
+ * 目标用户 id
818
+ */
819
+ targetUserId: string;
820
+ }
821
+
770
822
  export declare interface GetAttendanceDownloadRecordOptions {
771
823
  pageNumber?: number;
772
824
  pageSize?: number;
@@ -864,6 +916,13 @@ export declare interface GetOnlineListOptions {
864
916
  getBanStatus?: boolean;
865
917
  }
866
918
 
919
+ export declare interface GetSessionHistoryCountOptions {
920
+ /**
921
+ * 场次号
922
+ */
923
+ sessionId: string;
924
+ }
925
+
867
926
  export declare interface GetSpeakOriginalContentOptions {
868
927
  /**
869
928
  * 发言消息
@@ -871,6 +930,8 @@ export declare interface GetSpeakOriginalContentOptions {
871
930
  chatMsg: ChatMsgSpeakType;
872
931
  }
873
932
 
933
+ export declare const GlobalVariable = "PolyvChat";
934
+
874
935
  /**
875
936
  * 历史消息模块
876
937
  */
@@ -897,6 +958,10 @@ declare class HistoryModule extends ChatModuleBase {
897
958
  */
898
959
  private __getHistoryExclude;
899
960
  getChatHistoryByWorkWechatTagId(options?: GetChatHistoryByWorkWechatTagIdOptions): Promise<ChatMsgType[]>;
961
+ /**
962
+ * 获取场次历史消息数量
963
+ */
964
+ getSessionHistoryCount(options: GetSessionHistoryCountOptions): Promise<number>;
900
965
  }
901
966
 
902
967
  declare interface InternalSpeakTopData {
@@ -942,6 +1007,28 @@ export declare interface KickUserOptions {
942
1007
  userId: string;
943
1008
  }
944
1009
 
1010
+ declare class LikeModule extends ChatModuleBase {
1011
+ /**
1012
+ * 实时点赞数
1013
+ */
1014
+ private __realtimeLikes;
1015
+ constructor(plvChat: PolyvChat);
1016
+ /**
1017
+ * 获取实时点赞数
1018
+ */
1019
+ getRealtimeLikes(): number;
1020
+ /**
1021
+ * 更新点赞数
1022
+ * @param realtimeLikes 点赞数
1023
+ */
1024
+ setRealtimeLikes(realtimeLikes: number): void;
1025
+ /**
1026
+ * 发送点赞
1027
+ * @param times 点赞次数
1028
+ */
1029
+ sendLike(times: number): Promise<number>;
1030
+ }
1031
+
945
1032
  export declare enum ManageFailReason {
946
1033
  /** 未知错误 */
947
1034
  UnknownError = "UnknownError",
@@ -1171,6 +1258,13 @@ declare class OnlineModule extends ChatModuleBase {
1171
1258
  * @param options 获取选项
1172
1259
  */
1173
1260
  getOnlineList(options?: GetOnlineListOptions): Promise<OnlineListResult>;
1261
+ /**
1262
+ * 获取在线列表(观众)
1263
+ */
1264
+ private __getOnlineListByViewer;
1265
+ /**
1266
+ * 获取在线列表(搜索)
1267
+ */
1174
1268
  private __getOnlineListByKeyword;
1175
1269
  /**
1176
1270
  * 获取在线列表(普通)
@@ -1252,7 +1346,7 @@ export declare class PolyvChat {
1252
1346
  status: StatusModule;
1253
1347
  /** 工具模块 */
1254
1348
  utils: UtilsModule;
1255
- /** 发送模块 */
1349
+ /** 聊天消息发送模块 */
1256
1350
  sender: SenderModule;
1257
1351
  /** 管理模块 */
1258
1352
  manage: ManageModule;
@@ -1260,6 +1354,10 @@ export declare class PolyvChat {
1260
1354
  online: OnlineModule;
1261
1355
  /** 下载导出模块 */
1262
1356
  download: DownloadModule;
1357
+ /** 点赞模块 */
1358
+ like: LikeModule;
1359
+ /** 提问模块 */
1360
+ ask: AskModule;
1263
1361
  constructor(plvSocket: PolyvSocket, config?: PolyvChatConfig);
1264
1362
  /** 是否设置完成 */
1265
1363
  setuped: boolean;
@@ -1267,6 +1365,7 @@ export declare class PolyvChat {
1267
1365
  * 设置聊天室
1268
1366
  */
1269
1367
  setup(): Promise<void>;
1368
+ destroy(): Promise<void>;
1270
1369
  }
1271
1370
 
1272
1371
  export declare interface PolyvChatConfig {
@@ -1279,6 +1378,11 @@ export declare interface PolyvChatConfig {
1279
1378
  * @default false
1280
1379
  */
1281
1380
  chatHistoryEncrypt?: boolean;
1381
+ /**
1382
+ * 默认点赞数
1383
+ * @default 0
1384
+ */
1385
+ defaultLikes?: number;
1282
1386
  }
1283
1387
 
1284
1388
  export declare enum PolyvChatEvent {
@@ -1290,6 +1394,14 @@ export declare enum PolyvChatEvent {
1290
1394
  * 状态信息更新事件
1291
1395
  */
1292
1396
  StatusInfoUpdate = "StatusInfoUpdate",
1397
+ /**
1398
+ * 用户登录事件
1399
+ */
1400
+ UserLogin = "UserLogin",
1401
+ /**
1402
+ * 用户退出事件
1403
+ */
1404
+ UserLogout = "UserLogout",
1293
1405
  /**
1294
1406
  * 聊天消息事件
1295
1407
  */
@@ -1357,7 +1469,27 @@ export declare enum PolyvChatEvent {
1357
1469
  /**
1358
1470
  * 商品下单数量事件
1359
1471
  */
1360
- ProductBuyTimes = "ProductBuyTimes"
1472
+ ProductBuyTimes = "ProductBuyTimes",
1473
+ /**
1474
+ * 签到次数事件
1475
+ */
1476
+ CheckInTimes = "CheckInTimes",
1477
+ /**
1478
+ * 点赞数更新事件
1479
+ */
1480
+ ChatLikesUpdate = "ChatLikesUpdate",
1481
+ /**
1482
+ * 聊天点赞
1483
+ */
1484
+ ChatLike = "ChatLike",
1485
+ /**
1486
+ * 发送点赞
1487
+ */
1488
+ SendChatLike = "SendChatLike",
1489
+ /**
1490
+ * 提问消息事件
1491
+ */
1492
+ AskMessage = "AskMessage"
1361
1493
  }
1362
1494
 
1363
1495
  export declare type PolyvChatEventRelations = {
@@ -1367,6 +1499,22 @@ export declare type PolyvChatEventRelations = {
1367
1499
  */
1368
1500
  statusInfo: ChatStatusInfo;
1369
1501
  };
1502
+ [PolyvChatEvent.UserLogin]: {
1503
+ /**
1504
+ * 用户信息
1505
+ */
1506
+ user: ChatMessageUser;
1507
+ };
1508
+ [PolyvChatEvent.UserLogout]: {
1509
+ /**
1510
+ * 用户 id
1511
+ */
1512
+ userId: string;
1513
+ /**
1514
+ * 用户昵称
1515
+ */
1516
+ nick: string;
1517
+ };
1370
1518
  [PolyvChatEvent.ChatMessage]: {
1371
1519
  /**
1372
1520
  * 聊天消息对象
@@ -1483,6 +1631,60 @@ export declare type PolyvChatEventRelations = {
1483
1631
  */
1484
1632
  productType: string;
1485
1633
  };
1634
+ [PolyvChatEvent.CheckInTimes]: {
1635
+ /**
1636
+ * 用户昵称
1637
+ */
1638
+ nickname: string;
1639
+ /**
1640
+ * 次数
1641
+ */
1642
+ count: number;
1643
+ };
1644
+ [PolyvChatEvent.ChatLikesUpdate]: {
1645
+ /**
1646
+ * 点赞数
1647
+ */
1648
+ realtimeLikes: number;
1649
+ };
1650
+ [PolyvChatEvent.ChatLike]: {
1651
+ /**
1652
+ * 点赞数
1653
+ */
1654
+ count: number;
1655
+ /**
1656
+ * 实时点赞数
1657
+ */
1658
+ realtimeLikes: number;
1659
+ /**
1660
+ * 用户 id
1661
+ */
1662
+ userId: string;
1663
+ /**
1664
+ * 用户昵称
1665
+ */
1666
+ nick: string;
1667
+ /**
1668
+ * 是否自己点赞
1669
+ */
1670
+ isSelf: boolean;
1671
+ };
1672
+ [PolyvChatEvent.SendChatLike]: {
1673
+ /**
1674
+ * 点赞数
1675
+ */
1676
+ count: number;
1677
+ };
1678
+ [PolyvChatEvent.AskMessage]: {
1679
+ /**
1680
+ * 提问消息
1681
+ */
1682
+ askMsg: AskMsgType;
1683
+ /**
1684
+ * 目标用户 id
1685
+ */
1686
+ targetUserId: string;
1687
+ };
1486
1688
  };
1487
1689
 
1488
1690
  export declare interface PushMsgToQaOptions {
@@ -1560,6 +1762,54 @@ export declare interface ResultSuccessBasic {
1560
1762
  success: true;
1561
1763
  }
1562
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
+
1563
1813
  export declare interface SendCustomServerMsgOptions {
1564
1814
  /**
1565
1815
  * 自定义消息内容
@@ -1785,7 +2035,11 @@ export declare enum SystemMsgType {
1785
2035
  /**
1786
2036
  * 聊天区通知
1787
2037
  */
1788
- ChatRoomIntroduction = "chat-room-introduction"
2038
+ ChatRoomIntroduction = "chat-room-introduction",
2039
+ /**
2040
+ * 违规词
2041
+ */
2042
+ ForbiddenWord = "forbidden-word"
1789
2043
  }
1790
2044
 
1791
2045
  export declare interface TopingMsgData {
@@ -1885,6 +2139,11 @@ export declare interface UploadMultiImageReadyResult {
1885
2139
  imageId: string;
1886
2140
  /** 图片预览url */
1887
2141
  previewSrc: string;
2142
+ /** 图片尺寸 */
2143
+ size: {
2144
+ width: number;
2145
+ height: number;
2146
+ };
1888
2147
  }
1889
2148
 
1890
2149
  export declare interface UploadMultiImageResult {