This commit is contained in:
shoopea 2019-12-29 11:29:39 +08:00
parent 9fbf63ded4
commit 24160a4086

13
main.go
View File

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