This commit is contained in:
shoopea 2019-05-03 18:31:57 +08:00
parent 88ac74be9b
commit 9287915b39

3
td.go
View File

@ -109,6 +109,7 @@ func ListenCW(c *tdlib.Client) {
func getHistory(c *tdlib.Client) { func getHistory(c *tdlib.Client) {
var lastMsgID64 int64 = int64(math.MaxInt64) var lastMsgID64 int64 = int64(math.MaxInt64)
var msgCount int32 = 0
conn, err := amqp.Dial("amqp://" + cfg.Rabbit.User + ":" + cfg.Rabbit.Password + "@" + cfg.Rabbit.Host + "/" + cfg.Rabbit.Queue) conn, err := amqp.Dial("amqp://" + cfg.Rabbit.User + ":" + cfg.Rabbit.Password + "@" + cfg.Rabbit.Host + "/" + cfg.Rabbit.Queue)
if err != nil { if err != nil {
@ -169,12 +170,14 @@ func getHistory(c *tdlib.Client) {
if msg.ID < lastMsgID64 { if msg.ID < lastMsgID64 {
lastMsgID64 = msg.ID lastMsgID64 = msg.ID
} }
msgCount = msgCount + 1
default: default:
log.Printf("getHistory : no handler for %s\n", msg.Content) log.Printf("getHistory : no handler for %s\n", msg.Content)
} }
} }
} }
} }
log.Printf("Exported %d messages.\n", msgCount)
} }
func ForwardMsg(c *tdlib.Client, msgID int64, fromChatID int64, toChatID int64) int64 { func ForwardMsg(c *tdlib.Client, msgID int64, fromChatID int64, toChatID int64) int64 {