fix delay

This commit is contained in:
shoopea 2019-08-23 13:53:54 +08:00
parent 97619d1a45
commit fdf3d4e0dd

4
td.go
View File

@ -224,6 +224,9 @@ func OwnUserID(c *tdlib.Client) int32 {
} }
func clientMsg(c *tdlib.Client, m TGCommand) { func clientMsg(c *tdlib.Client, m TGCommand) {
if m.Delay != 0 {
time.Sleep(time.Duration(m.Delay * time.Second))
}
switch m.Type { switch m.Type {
case commandSendMsg: case commandSendMsg:
msgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText(m.Text, nil), true, true) msgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText(m.Text, nil), true, true)
@ -254,4 +257,3 @@ func clientMsg(c *tdlib.Client, m TGCommand) {
log.Printf("ListenMQ : No handler for command %d.\n", m.Type) log.Printf("ListenMQ : No handler for command %d.\n", m.Type)
} }
} }
}