Files
picoclaw/pkg/commands/cmd_clear.go
T
lxowalle aaf99d7a30 feat: add /clear command to clear chat history (#1266)
* * add clear command to clear chat history

* check nil

* * update comment
2026-03-09 16:39:33 +08:00

21 lines
508 B
Go

package commands
import "context"
func clearCommand() Definition {
return Definition{
Name: "clear",
Description: "Clear the chat history",
Usage: "/clear",
Handler: func(_ context.Context, req Request, rt *Runtime) error {
if rt == nil || rt.ClearHistory == nil {
return req.Reply(unavailableMsg)
}
if err := rt.ClearHistory(); err != nil {
return req.Reply("Failed to clear chat history: " + err.Error())
}
return req.Reply("Chat history cleared!")
},
}
}