From 8cbe77fef6dd133aa5348039762b03cc3073b02f Mon Sep 17 00:00:00 2001 From: TERMI80 <32610825+TERMI80@users.noreply.github.com> Date: Thu, 19 Oct 2017 12:24:35 +0200 Subject: [PATCH] Update and rename TestDavide to TlsTelegramAut --- TestDavide | 1 - TlsTelegramAut | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) delete mode 100644 TestDavide create mode 100644 TlsTelegramAut diff --git a/TestDavide b/TestDavide deleted file mode 100644 index 8b13789..0000000 --- a/TestDavide +++ /dev/null @@ -1 +0,0 @@ - diff --git a/TlsTelegramAut b/TlsTelegramAut new file mode 100644 index 0000000..5364af7 --- /dev/null +++ b/TlsTelegramAut @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TLSharp; +using TeleSharp.TL; +using TLSharp.Core; +namespace TLC +{ + class Program + { + + static string phoneCodeHash; + static void Main(string[] args) + { + + Run(); + + + + } + static async void Run() + { + var store = new FakeSessionStore(); + string Alert = "ciao"; + TLUser user = null; + var client = new TelegramClient(117394, "b429bd4470c9b2bc24c9d128dbfa2a4a",store); + bool isConnect = await client.ConnectAsync(); + if (client.IsUserAuthorized()) + { + //get available contacts + var result = await client.GetContactsAsync(); + + //find recipient in contacts + // var userr = result.users.lists.Where(x => x.GetType() == typeof(TLUser)).Cast().FirstOrDefault(x => x.phone == "98" + TextBox1.Text); + + //send message + await client.SendMessageAsync(new TLInputPeerUser() { user_id = user.id }, Alert); + } + else + { + phoneCodeHash = await client.SendCodeRequestAsync("393392803198"); + Task.WaitAll(); + + } + + } + } +}