Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle updates based on certain criteria (filter) [help wanted] #8

Closed
itshaadi opened this issue Aug 5, 2019 · 2 comments
Closed

Comments

@itshaadi
Copy link

itshaadi commented Aug 5, 2019

How can I for example react to new messages that are forwarded?

tdlibClient, err := client.NewClient(authorizer, WithLogs())
if err != nil {
	log.Fatalf("NewClient error: %s", err)
} else {
	log.Println("Ready !")
}

listener := tdlibClient.GetListener()
defer listener.Close()

for update := range listener.Updates {
	if update.GetType() == client.TypeUpdateNewMessage {
		// ???
	}
}
@itshaadi
Copy link
Author

itshaadi commented Aug 6, 2019 via email

@zelenin
Copy link
Owner

zelenin commented Aug 7, 2019

    for update := range listener.Updates {
        if update.GetType() == client.TypeUpdateNewMessage {
            message := update.(*client.UpdateNewMessage)
            if message.Message.ForwardInfo != nil {
                log.Print("Bingo!")
            }
        }
    }

@itshaadi itshaadi closed this as completed Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants