- err = daemonRunRequest(l, h.whatsapp, request, func(text string) {
- h.Send(client, Event{
- Kind: "notice",
- Text: text,
+ if request.Type == "backup" {
+ var size int64
+
+ size, err = backupData(ctx, filepath.Dir(l.agent.dir), request.Text, h.whatsapp, l.runs.Snapshot)
+ if err == nil {
+ h.Send(client, Event{
+ Kind: "backup",
+ Text: fmt.Sprintf("%s (%d bytes)", request.Text, size),
+ })
+ }
+ } else {
+ err = daemonRunRequest(l, h.whatsapp, request, func(text string) {
+ h.Send(client, Event{
+ Kind: "notice",
+ Text: text,
+ })