From eb7326d96bf832e99344f2b1b95f1e0c3b97013a Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 24 Aug 2019 14:00:45 +0800 Subject: [PATCH] fix delay --- def.go | 2 +- td.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/def.go b/def.go index 387a997..8217124 100644 --- a/def.go +++ b/def.go @@ -16,7 +16,7 @@ type TGCommand struct { Text string `json:"text"` Document tb.Document `json:"document"` ParseMode int64 `json:"parse_mode"` - Delay int64 `json:"delay"` + Delay time.Delay `json:"delay"` } type ChatWarsMessage struct { diff --git a/td.go b/td.go index 2ea6a8a..2c61769 100644 --- a/td.go +++ b/td.go @@ -219,8 +219,8 @@ func OwnUserID(c *tdlib.Client) int32 { } func clientMsg(c *tdlib.Client, m TGCommand) { - log.Printf("clientMsg : Delaying message by %d seconds.\n", m.Delay) - if m.Delay != 0 { + log.Printf("clientMsg : Delaying message by %d seconds.\n", int64(m.Delay)) + if m.Delay != time.Duration(0) { time.Sleep(time.Duration(m.Delay) * time.Second) } for {