This commit is contained in:
shoopea 2019-05-04 00:01:39 +08:00
parent f2bac0aef4
commit 385be7f14c

10
td.go
View File

@ -156,9 +156,12 @@ func getHistory(c *tdlib.Client) {
MsgID64: msg.ID, MsgID64: msg.ID,
} }
b, _ := json.Marshal(m) b, err := json.Marshal(m)
if err != nil {
logOnError(err, "getHistory : Marshaling message.")
}
_ = ch.Publish( err = ch.Publish(
"", // exchange "", // exchange
q.Name, // routing key q.Name, // routing key
false, // mandatory false, // mandatory
@ -167,6 +170,9 @@ func getHistory(c *tdlib.Client) {
ContentType: "application/json", ContentType: "application/json",
Body: []byte(b), Body: []byte(b),
}) })
if err != nil {
logOnError(err, "getHistory : Publishing message.")
}
if msg.ID < lastMsgID64 { if msg.ID < lastMsgID64 {
lastMsgID64 = msg.ID lastMsgID64 = msg.ID
lastMsgTime = time.Unix(int64(msg.Date), 0) lastMsgTime = time.Unix(int64(msg.Date), 0)