test
This commit is contained in:
parent
9fbf63ded4
commit
24160a4086
13
main.go
13
main.go
@ -68,13 +68,13 @@ func main() {
|
|||||||
ownUserID32 = OwnUserID(client)
|
ownUserID32 = OwnUserID(client)
|
||||||
ownUserID64 = int64(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)
|
getHistory(client, &chtwrsID64)
|
||||||
|
|
||||||
@ -187,8 +187,8 @@ func OwnUserID(c *tdlib.Client) int32 {
|
|||||||
func ListenMe(c *tdlib.Client) {
|
func ListenMe(c *tdlib.Client) {
|
||||||
eventFilter := func(msg *tdlib.TdMessage) bool {
|
eventFilter := func(msg *tdlib.TdMessage) bool {
|
||||||
updateMsg := (*msg).(*tdlib.UpdateNewMessage)
|
updateMsg := (*msg).(*tdlib.UpdateNewMessage)
|
||||||
senderUserID := updateMsg.Message.SenderUserID
|
senderUserID64 := int64(updateMsg.Message.SenderUserID)
|
||||||
if senderUserID == ownUserID32 {
|
if senderUserID == chtwrsID64 {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@ -198,5 +198,6 @@ func ListenMe(c *tdlib.Client) {
|
|||||||
receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100)
|
receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100)
|
||||||
for _ = range receiver.Chan {
|
for _ = range receiver.Chan {
|
||||||
log.Printf("ListenMe : updated.\n")
|
log.Printf("ListenMe : updated.\n")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user