聊天历史记录查询选项
Query chat history with various filtering options.
阅读时间3 分钟最后更新于 13 天前
ChatHistoryQueryOptions 是一个可选的选项模型,可以包含在
VivoxService.Instance.GetDirectTextMessageHistoryAsyncVivoxService.Instance.GetChannelTextMessageHistoryAsyncSearchText
ChatHistoryQueryOptionsvar options = new ChatHistoryQueryOptions();options.SearchText = "Hello, lobby!";var historyMessages = await VivoxService.Instance.GetChannelTextMessageHistoryAsync(LobbyChannelName, 10, options);
TimeStart - TimeEnd
ChatHistoryQueryOptionsDateTimes请注意,除非启用文本证据管理功能,否则聊天历史记录仅存储七天。var options = new ChatHistoryQueryOptions();options.TimeStart = DateTime.Now().AddDays(-1);options.TimeEnd = DateTime.Now().AddDays(-0.5);var historyMessages = await VivoxService.Instance.GetChannelTextMessageHistoryAsync(LobbyChannelName, 10, options);
PlayerId
对于ChannelTextMessageHistoryIReadOnlyCollection<VivoxMessage> GetMessagesFromPlayerAsync(VivoxParticipant participant){ var options = new ChatHistoryQueryOptions(); options.PlayerId = participant.PlayerId; var historyMessages = await VivoxService.Instance.GetChannelTextMessageHistoryAsync(LobbyChannelName, 10, options); return historyMessages;}
被屏蔽参与者的基于频道的聊天历史记录
在设置history_session被屏蔽参与者涉及的历史记录会话
如果历史记录请求中的所有消息都来自被屏蔽参与者,该请求可能会返回为空。在这种情况下,响应包含一个游标,指示后续页面上的频道中有更多消息。每个历史记录请求返回的默认消息数为每页 10 条。使用后续请求中的游标值可获取下一页消息。 如果频道中有被屏蔽用户,则最大页面大小参数 (Max) 显示的消息数少于请求的消息数。为聊天历史记录请求特定的页面大小时,请注意,如果频道中有被屏蔽用户,history_session