【问题标题】:how to add contacts in telegram-cli by using vcard?如何使用 vcard 在电报 cli 中添加联系人?
【发布时间】:2016-10-21 11:15:45
【问题描述】:

我正在尝试使用 vcard 在电报 cli 中添加我的联系人。但是当我使用这个命令时:

import_card <card>

什么都没发生!它只是进入下一行,没有任何错误,也没有添加联系人。

我的电子名片是 VERSION:2.1

如何使用 vcard 将我的联系人导入我的电报帐户?

【问题讨论】:

    标签: telegram vcf-vcard


    【解决方案1】:

    安装包 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);
    

    【讨论】:

      【解决方案2】:
      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;
              }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-02-08
        • 2017-11-19
        • 1970-01-01
        • 2016-02-26
        • 2017-01-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多