diff --git a/bot.go b/bot.go index e0df64a..ed6e8ed 100644 --- a/bot.go +++ b/bot.go @@ -274,6 +274,19 @@ func botTimer(m *tb.Message) { if r.MatchString(m.Payload) { log.Printf("Timer : Duration : %s\n", r.ReplaceAllString(m.Payload, "${Duration}")) log.Printf("Timer : Msg : %s\n", r.ReplaceAllString(m.Payload, "${Msg}")) + d, err := time.ParseDuration(r.ReplaceAllString(m.Payload, "${Duration}")) + if err != nil { + c := TGCommand{ + Type: commandReplyMsg, + Text: err, + FromMsgID64: int64(m.ID), + FromChatID64: m.Chat.ID, + } + TGCmdQueue <- c + } else { + log.Printf("Timer : Event : %s\n", time.Now().Add(d).Format(time.RFC822)) + } + } /* c := TGCommand{