From 24160a40862f60865c543e675f7f7ca75c9db9e4 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sun, 29 Dec 2019 11:29:39 +0800 Subject: [PATCH] test --- main.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 69ce22e..a4ca67c 100644 --- a/main.go +++ b/main.go @@ -68,13 +68,13 @@ func main() { ownUserID32 = OwnUserID(client) ownUserID64 = int64(OwnUserID(client)) - go ListenMe(client) + ListenMe(client) - fmt.Println("Sleep 10sec..") + fmt.Println("Got ChatWars message") - time.Sleep(10 * time.Second) + time.Sleep(11 * time.Second) - fmt.Println("Getting history...") + fmt.Println("Now getting history...") getHistory(client, &chtwrsID64) @@ -187,8 +187,8 @@ func OwnUserID(c *tdlib.Client) int32 { func ListenMe(c *tdlib.Client) { eventFilter := func(msg *tdlib.TdMessage) bool { updateMsg := (*msg).(*tdlib.UpdateNewMessage) - senderUserID := updateMsg.Message.SenderUserID - if senderUserID == ownUserID32 { + senderUserID64 := int64(updateMsg.Message.SenderUserID) + if senderUserID == chtwrsID64 { return true } else { return false @@ -198,5 +198,6 @@ func ListenMe(c *tdlib.Client) { receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100) for _ = range receiver.Chan { log.Printf("ListenMe : updated.\n") + return } }