TLsharp add user to gorup / channel telegram

641 views Asked by At

i could i add user to supergroup / channel using tlsharp i tried:

var contacts = new TLVector<TLInputPhoneContact>();
        contacts.Add(new TLInputPhoneContact { FirstName = "xxx", LastName = "xxx", Phone = "xxx" });
        var req = new TLRequestImportContacts()
        {
            Contacts = contacts
        };
        var contact = client.SendRequestAsync<TLImportedContacts>(req).GetAwaiter().GetResult();
1

There are 1 answers

0
David Con On

I have tried some think like this:

List<TLInputUser> users= new List<TLInputUser>();
foreach (TeleSharp.TL.TLUser user in users)
{
    usuarios.Add(new TLInputUser
    {
       UserId = user.Id,
       AccessHash = user.AccessHash.Value
    });
}

TeleSharp.TL.Channels.TLRequestInviteToChannel r = new TeleSharp.TL.Channels.TLRequestInviteToChannel
{
    Channel = new TLInputChannel
    {
       ChannelId = tlChannel.Id,
       AccessHash = tlChannel.AccessHash.Value
    },
    Users = new TLVector<TLAbsInputUser>(users)
};

But I received the exception USER_NOT_MUTUAL_CONTACT. Is there any other option to add a user to a group? Thank you very much.