sochix / TLSharp

Telegram client library implemented in C#
1k stars 380 forks source link

I can't kick a contact from the channel #TLRequestKickFromChannel() #953

Closed bliznec-89 closed 4 years ago

bliznec-89 commented 4 years ago

It doesn't show any errors, but the contact isn't deleted, what am I doing wrong?:

            var result = await client.GetContactsAsync();
            var uim = result.Users.ToList().Where(x => x.GetType() == typeof(TLUser)).Cast<TLUser>().FirstOrDefault(x => x.Phone == number);
            var dialogs = await client.GetUserDialogsAsync() as TLDialogsSlice;
            var chat = dialogs.Chats.ToList().Where(c => c.GetType() == typeof(TLChannel)).Cast<TLChannel>().LastOrDefault(c => c.Title == channelname);
            var inputuser = new TLInputUser() { AccessHash = uim.AccessHash.Value, UserId = uim.Id };
            var req2 = new TeleSharp.TL.Channels.TLRequestKickFromChannel() { Channel = new TLInputChannel() { AccessHash = chat.AccessHash.Value, ChannelId = chat.Id }, UserId = inputuser };
            var ups = await client.SendRequestAsync<TLUpdates>(req2);
bliznec-89 commented 4 years ago

Fixed.

knocte commented 4 years ago

And you're gonna share how did you fix it?