Files
picoclaw/pkg/commands/cmd_reload.go
T
Cytown 2a6ade0fe4 feat: add /reload to gateway api and command (#1725)
* feat: add /reload to gateway api and command

* prevent duplicate reload request in same time
2026-03-19 13:42:36 +08:00

21 lines
523 B
Go

package commands
import "context"
func reloadCommand() Definition {
return Definition{
Name: "reload",
Description: "Reload the configuration file",
Usage: "/reload",
Handler: func(_ context.Context, req Request, rt *Runtime) error {
if rt == nil || rt.ReloadConfig == nil {
return req.Reply(unavailableMsg)
}
if err := rt.ReloadConfig(); err != nil {
return req.Reply("Failed to reload configuration: " + err.Error())
}
return req.Reply("Config reload triggered!")
},
}
}