fix: add nil guards for conversationStore and engagementEngine in /ai new
This commit is contained in:
+7
-3
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user