如何使用 vcard 在 telegram-cli 中添加联系人?
how to add contacts in telegram-cli by using vcard?
我正在尝试使用 vcard 在 telegram-cli 中添加我的联系人。但是当我使用这个命令时:
import_card <card>
什么都没发生!它只是转到下一行而没有任何错误并且没有添加联系人。
我的名片是 VERSION:2.1
如何使用 vcard 将我的联系人添加到我的电报帐户?
安装包 TLSharp
client = new TelegramClient(apiId, apiHash);
await client.ConnectAsync();
var phoneContact = new TLInputPhoneContact() { phone = "", first_name = "", last_name = "" };
var contacts = new List<TLInputPhoneContact>() { phoneContact };
var req = new TeleSharp.TL.Contacts.TLRequestImportContacts() { contacts = new TLVector<TLInputPhoneContact>() { lists = contacts } };
var rrr= await client.SendRequestAsync<TeleSharp.TL.Contacts.TLImportedContacts>(req);
private async Task<bool> ImportContact(string _phone , string _first_name , string _last_name)
{
//https://github.com/sochix/TLSharp/issues/243
var phoneContact = new TLInputPhoneContact() { phone = _phone, first_name = _first_name, last_name = _last_name };
var contacts = new List<TLInputPhoneContact>() { phoneContact };
var req = new TLRequestImportContacts() { contacts = new TLVector<TLInputPhoneContact>() { lists = contacts } };
TLImportedContacts result = await client.SendRequestAsync<TLImportedContacts>(req);
if (result.users.lists.Count > 0)
return true;
else return false;
}
我正在尝试使用 vcard 在 telegram-cli 中添加我的联系人。但是当我使用这个命令时:
import_card <card>
什么都没发生!它只是转到下一行而没有任何错误并且没有添加联系人。
我的名片是 VERSION:2.1
如何使用 vcard 将我的联系人添加到我的电报帐户?
安装包 TLSharp
client = new TelegramClient(apiId, apiHash);
await client.ConnectAsync();
var phoneContact = new TLInputPhoneContact() { phone = "", first_name = "", last_name = "" };
var contacts = new List<TLInputPhoneContact>() { phoneContact };
var req = new TeleSharp.TL.Contacts.TLRequestImportContacts() { contacts = new TLVector<TLInputPhoneContact>() { lists = contacts } };
var rrr= await client.SendRequestAsync<TeleSharp.TL.Contacts.TLImportedContacts>(req);
private async Task<bool> ImportContact(string _phone , string _first_name , string _last_name)
{
//https://github.com/sochix/TLSharp/issues/243
var phoneContact = new TLInputPhoneContact() { phone = _phone, first_name = _first_name, last_name = _last_name };
var contacts = new List<TLInputPhoneContact>() { phoneContact };
var req = new TLRequestImportContacts() { contacts = new TLVector<TLInputPhoneContact>() { lists = contacts } };
TLImportedContacts result = await client.SendRequestAsync<TLImportedContacts>(req);
if (result.users.lists.Count > 0)
return true;
else return false;
}