go-tdlib 如何使用 SearchContacts

问题描述

我想根据用户名搜索未知用户

我正在使用 this 库中的 SearchContacts 方法。根据方法签名,第一个参数应该是表示查询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

看起来没有搜索未知用户的方法。