Getting messages from the history
The API automatically registers messages sent by players in its history. Let's learn how to access them:
Getting by ID
If we know the message's ID, we can simply get the message's context:
Getting by ChatChannel
Getting all the messages sent in a specific channel with the ChatHistory::getByChannel
method:
List<SocialRegisteredMessageContext> messages = Social.get().getChatManager().getHistory().getByChannel(channel);
Getting by SocialUser
Similarly, we can get all the messages sent by a specific user:
List<SocialRegisteredMessageContext> messages = Social.get().getChatManager().getHistory().getByUser(user);
Filtering by text
The API also allows searching the whole history and filtering by a specific literal string: