OK.
You are parsing something and extracting a user, message and a time from it. User and message are strings and time is an int.
I would define this record.
Code:
record conversation {
string user;
string message;
int time;
}
I would then declare an "array" of the record.
I would read and write using the utilities.
map_to_file(chatz,"chatHistory.txt");
file_to_map("chatHistory.txt", chatz);
I would add a new conversation record by...
Code:
conversation newConv;
newConv.user = ...
newConv.message = ...
newConv.time = ...
chatz[count(chatz)+1] = newConv;
The ... means fill in the data you parsed from elsewhere.
I think you know how to iterate and search.
This assumes that the integer used to index the map is not really relevant - it doesn't matter what order the "conversations" occur in the file.
It might be important to know the date of when things happened. That could be done by using a new file for each date or by adding a date to the record or by converting the time into a timestamp yyyymmddhhmmss.
I have not tested any of the code.
I have no game or social reason to use chat and I do keep a character who has never visited the Altar of Literacy to test mafia, but I'm actually OK with you trying things with a chatbot.