This commit is contained in:
shoopea 2019-05-26 20:40:37 +08:00
parent 7d5d5ec4d5
commit 6f418b11c3

13
bot.go
View File

@ -274,6 +274,19 @@ func botTimer(m *tb.Message) {
if r.MatchString(m.Payload) { if r.MatchString(m.Payload) {
log.Printf("Timer : Duration : %s\n", r.ReplaceAllString(m.Payload, "${Duration}")) log.Printf("Timer : Duration : %s\n", r.ReplaceAllString(m.Payload, "${Duration}"))
log.Printf("Timer : Msg : %s\n", r.ReplaceAllString(m.Payload, "${Msg}")) 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{ c := TGCommand{