Added support for MOTD and whispers. Commands can opt into responding to whispers and there's a helper method to handle replying through the correct channel.

This commit is contained in:
barelyprofessional
2026-03-18 23:50:32 -05:00
parent 4cdb04e3c5
commit 01a4b26326
44 changed files with 683 additions and 148 deletions

View File

@@ -0,0 +1,44 @@
using KfChatDotNetWsClient.Models.Events;
namespace KfChatDotNetBot.Models;
public class BotCommandMessageModel
{
/// <summary>
/// Author of the message
/// </summary>
public required UserModel Author { get; set; }
/// <summary>
/// Recipient of the message if this is a whisper
/// </summary>
public UserModel? Recipient { get; set; }
/// <summary>
/// Message rendered into HTML
/// </summary>
public required string Message { get; set; }
/// <summary>
/// Original message with BBCode intact (but HTML-encoded)
/// </summary>
public required string MessageRaw { get; set; }
/// <summary>
/// Date and time the message was sent
/// </summary>
public required DateTimeOffset MessageDate { get; set; }
/// <summary>
/// Original message with BBCode intact and HTML decoded
/// </summary>
public required string MessageRawHtmlDecoded { get; set; }
/// <summary>
/// Chat UUID reference to the message (null for whispers)
/// </summary>
public string? MessageUuid { get; set; }
/// <summary>
/// When the message was edited (null if never edited or a whisper)
/// </summary>
public DateTimeOffset? MessageEditDate { get; set; }
/// <summary>
/// Room ID where this message was received. (null if a whisper)
/// </summary>
public int? RoomId { get; set; }
public required bool IsWhisper { get; set; }
}

View File

@@ -4,6 +4,9 @@ public class SentMessageTrackerModel
{
// Unique GUID for each message
public required string Reference { get; set; }
/// <summary>
/// The raw message. If this was a whisper, it'll include the '/w id msg' payload
/// </summary>
public required string Message { get; set; }
public required SentMessageTrackerStatus Status { get; set; }
public string? ChatMessageUuid { get; set; }
@@ -15,6 +18,11 @@ public class SentMessageTrackerModel
/// When edited multiple times, it'll be the most recent edit
/// </summary>
public DateTimeOffset? LastEdited { get; set; } = null;
public required SentMessageType Type { get; set; }
/// <summary>
/// Contains just the whisper message
/// </summary>
public string? WhisperMessage { get; set; }
}
public enum SentMessageTrackerStatus
@@ -29,4 +37,10 @@ public enum SentMessageTrackerStatus
ChatDisconnected,
// Was held in the replay buffer due to a disconnect, but there were too many messages ahead of it and so was culled
Lost
}
public enum SentMessageType
{
ChatMessage,
Whisper
}