Browse Source

Add message when deferring command for later

master
Gregory Rudolph 3 years ago
parent
commit
d08e5025fc
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 4
      commands.go

4
commands.go

@ -88,7 +88,8 @@ func listVehicles(m chat1.MsgSummary) { @@ -88,7 +88,8 @@ func listVehicles(m chat1.MsgSummary) {
func deferTime(m chat1.MsgSummary) {
parts := strings.Split(m.Content.Text.Body, " ")
t := parts[1]
m.Content.Text.Body = fmt.Sprintf("!%+v", strings.Join(parts[1:], " "))
command := strings.Join(parts[1:], " ")
m.Content.Text.Body = fmt.Sprintf("!%+v", command)
timer, err := time.ParseDuration(t)
if err != nil {
tracker := uuid.NewString()
@ -96,6 +97,7 @@ func deferTime(m chat1.MsgSummary) { @@ -96,6 +97,7 @@ func deferTime(m chat1.MsgSummary) {
log.LogError("%+v: %+v", tracker, err)
return
}
k.SendMessageByConvID(m.ConvID, fmt.Sprintf("I will run %+v at %+v", command, time.Now().Add(timer)))
time.Sleep(timer)
handleChat(m)
}

Loading…
Cancel
Save