Implement millisecond timestamps for chat history

This commit is contained in:
RebeccaNod1 2026-05-08 19:29:12 -06:00
parent 40abda5eee
commit 0223fdffc5

View file

@ -547,7 +547,8 @@ namespace SecondBotEvents.Services
{ {
lock (localChatHistory) lock (localChatHistory)
{ {
localChatHistory.Add("{BOT} " + typeTag + GetClient().Self.Name + ": " + message); long ms = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
localChatHistory.Add("[" + ms + "] {BOT} " + typeTag + GetClient().Self.Name + ": " + message);
if (localChatHistory.Count <= myConfig.GetLocalChatHistoryLimit()) if (localChatHistory.Count <= myConfig.GetLocalChatHistoryLimit())
{ {
return; return;
@ -564,7 +565,8 @@ namespace SecondBotEvents.Services
{ {
return; // chat window not open unable to record message return; // chat window not open unable to record message
} }
chatWindows[sessionID].Add(fromname + ": " + message); long ms = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
chatWindows[sessionID].Add("[" + ms + "] " + fromname + ": " + message);
chatWindowsUnread[sessionID] = true; chatWindowsUnread[sessionID] = true;
int purgeLen = myConfig.GetImChatHistoryLimit(); int purgeLen = myConfig.GetImChatHistoryLimit();
if (chatWindowsIsGroup[sessionID] == true) if (chatWindowsIsGroup[sessionID] == true)
@ -1351,7 +1353,8 @@ namespace SecondBotEvents.Services
AddAvatar(e.SourceID, e.FromName); AddAvatar(e.SourceID, e.FromName);
} }
localChatHistory.Add(source + " " + typeTag + e.FromName + ": " + e.Message); long ms = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
localChatHistory.Add("[" + ms + "] " + source + " " + typeTag + e.FromName + ": " + e.Message);
if (localChatHistory.Count <= myConfig.GetLocalChatHistoryLimit()) if (localChatHistory.Count <= myConfig.GetLocalChatHistoryLimit())
{ {
break; break;