public static List <ChannelInfo> Test(List <Channel> channels, Int32 id_user) { var client = new TLSharp.Core.TelegramClient(833968, "a6c65fd9460c44e42c5268b5601c849f"); var isAuth = client.IsUserAuthorized(); Console.WriteLine($"Файл авторизации существует: {isAuth}"); client.ConnectAsync().Wait(); var res_2 = StartInfoChannel.GetInfoGroup(channels, client).Result; List <ChannelInfo> ListFoundChannels = StartInfoChannel.GetChannelByUser(res_2, id_user); foreach (var item in ListFoundChannels) { foreach (var item2 in item.Users) { Console.WriteLine("User: "******"Admin: " + item2.FirstName); } } return(ListFoundChannels); }
public virtual async Task <bool> IsUserAuthorized() { var client = new TLSharp.Core.TelegramClient(apiId, apiHash); await client.ConnectAsync(); return(client.IsUserAuthorized()); }
private async void Auth(TLSharp.Core.TelegramClient client, string PhoneNumber) { if (client.IsUserAuthorized()) { return; } //인증-한번 받으면 된다 var hash = await client.SendCodeRequestAsync(PhoneNumber); var code = "20948"; // you can change code in debugger var user = await client.MakeAuthAsync(PhoneNumber, hash, code); }
/// <summary> /// 인증여부를 확인합니다. /// </summary> /// <returns></returns> public bool isAuth() { return(client.IsUserAuthorized()); }