Getting messages from the history
The API automatically records messages sent by players in the chat history. These messages can be retrieved through the ChatHistory component provided by the ChatManager.
Each stored message is represented by a SocialRegisteredMessageContext, which contains the message metadata and associated context.
Getting by ID
If the message ID is known, the corresponding message context can be retrieved directly:
Getting by ChatChannel
You can retrieve all messages sent in a specific ChatChannel:
List<SocialRegisteredMessageContext> messages = Social.get().getChatManager().getHistory().getByChannel(channel);
Getting by SocialUser
Messages can also be queried by the user who sent them:
List<SocialRegisteredMessageContext> messages = Social.get().getChatManager().getHistory().getByUser(user);
Filtering by text
The API also supports searching the chat history for messages containing a specific literal string:
This performs a literal text match against stored messages and returns all matching results.