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

@@ -53,8 +53,9 @@ public class NoraCommand : ICommand
MaxInvocations = 3,
Flags = RateLimitFlags.None
};
public bool WhisperCanInvoke => false;
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user,
public async Task RunCommand(ChatBot botInstance, BotCommandMessageModel message, UserDbModel user,
GroupCollection arguments, CancellationToken ctx)
{
var userMessage = arguments["message"].Value.Trim();
@@ -75,7 +76,7 @@ public class NoraCommand : ICommand
return;
}
var resetKey = ConversationContextManager.GetContextKeyAsync(mode, user.KfId, message.RoomId);
var resetKey = ConversationContextManager.GetContextKeyAsync(mode, user.KfId, message.RoomId!.Value);
var cleared = await manager.ClearContextAsync(resetKey);
await botInstance.SendChatMessageAsync(
cleared
@@ -166,7 +167,7 @@ public class NoraCommand : ICommand
// Compute context key once (used for mood and later for context messages)
string? contextKey = null;
if (!contextDisabled)
contextKey = ConversationContextManager.GetContextKeyAsync(contextMode, user.KfId, message.RoomId);
contextKey = ConversationContextManager.GetContextKeyAsync(contextMode, user.KfId, message.RoomId!.Value);
// Optionally inject user info into the system prompt
var userInfoEnabled = settings[BuiltIn.Keys.GrokNoraUserInfoEnabled].Value?.Equals("true", StringComparison.OrdinalIgnoreCase) == true;