简体   繁体   中英

go-tdlib how to use SearchContacts

I want to search for an unknown user based on the username.

I am using the SearchContacts method from this library. Based on the method signature, the first argument should be a string that represents the query. Unfortunately, I cannot find any documentation on how the query has to be formatted.

Below you can find my code snippet:

contacts, err := telegramClient.SearchContacts(fmt.Sprintf("username=%s", username), 1)

According to the documentation:

// SearchContacts Searches for the specified query in the first names, last names
// and usernames of the known user contacts
// @param query Query to search for; may be empty to return all contacts
// @param limit The maximum number of users to be returned
func (client *Client) SearchContacts(query string, limit int32) (*Users, error) {
    // ...
}

It looks like that function does not search for unknown users, but only for known user contacts .

It does not look like there is a method to search for unknown users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM