我想根据用户名搜索未知用户。
我正在使用这个库中的SearchContacts
方法。根据方法签名,第一个参数应该是表示查询的 a。不幸的是,我找不到任何关于如何格式化查询的文档。string
您可以在下面找到我的代码片段:
contacts, err := telegramClient.SearchContacts(fmt.Sprintf("username=%s", username), 1)
根据文档:
// 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) {
// ...
}
看起来该功能不搜索未知用户,而仅搜索known user contacts
.
似乎没有搜索未知用户的方法。