fix: add nil guards for conversationStore and engagementEngine in /ai new

This commit is contained in:
2026-06-17 02:12:43 +02:00
parent b2c9d2748a
commit ebea69c5f3
+7 -3
View File
@@ -50,10 +50,14 @@ func (p *Plugin) ExecuteCommand(_ *plugin.Context, args *model.CommandArgs) (res
return p.response(helpText), nil
case parts[0] == "new":
if err := p.conversationStore.Reset(args.UserId, args.ChannelId); err != nil {
p.API.LogError("Failed to reset conversation", "error", err.Error())
if p.conversationStore != nil {
if err := p.conversationStore.Reset(args.UserId, args.ChannelId); err != nil {
p.API.LogError("Failed to reset conversation", "error", err.Error())
}
}
if p.engagementEngine != nil {
p.engagementEngine.Sleep(args.UserId, args.ChannelId)
}
p.engagementEngine.Sleep(args.UserId, args.ChannelId)
return p.response("Conversation reset. @matty to start again."), nil
case parts[0] == "persona" && len(parts) == 1: