From 6f418b11c3138da1cfc8abd537fd5069b314025b Mon Sep 17 00:00:00 2001 From: shoopea Date: Sun, 26 May 2019 20:40:37 +0800 Subject: [PATCH] test --- bot.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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{