Example #1
0
        private static async Task MakeAuthentication(TLSharp.Core.TelegramClient client, string mainPhoneNumber)
        {
            var hash = await client.SendCodeRequestAsync(mainPhoneNumber);

            Console.WriteLine("waiting for code");
            var code = Console.ReadLine();
            var user = await client.MakeAuthAsync(mainPhoneNumber, hash, code);

            if (!client.IsUserAuthorized())
            {
                hash = await client.SendCodeRequestAsync(mainPhoneNumber);

                Console.WriteLine("please try again.add code");
                code = Console.ReadLine();
                user = await client.MakeAuthAsync(mainPhoneNumber, hash, code);
            }
        }