TLSharp不再维护。您可能希望切换到WTelegramClient,它与WTelegramAClient类似,但更好
那么它就简单到:
现在我通过反射得到了联系人的电话号码列表。还有别的办法吗?
var userContacts = await client.GetContactsAsync();
foreach (var user in userContacts.Users)
{
var props = user.GetType().GetProperties();
foreach (var prop in props)
{
if (prop.Name == "Phone")
{
listPhones.Add(prop.GetValue(user).ToString());
}
}
}
那么它就简单到:
var contacts = await client.Contacts_GetContacts(0);
foreach (var (id, user) in contacts.users)
listPhones.Add(user.phone);