fix delay

This commit is contained in:
shoopea 2019-08-24 14:00:45 +08:00
parent 43ef0a50fc
commit eb7326d96b
2 changed files with 3 additions and 3 deletions

2
def.go
View File

@ -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 {

4
td.go
View File

@ -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 {