private void BGetID_Click(object sender, EventArgs e) { if (tblTelegramBotAPI.Text != "") { string telegramGetUpdates = "https://api.telegram.org/bot" + tblTelegramBotAPI.Text + "/getUpdates"; WebClient webclient = new WebClient(); try { Telegram telegramMsg = Telegram.FromJson(webclient.DownloadString(telegramGetUpdates)); tbTelegramChatID.Text = telegramMsg.Result[0].Message.Chat.Id.ToString(); } catch (Exception ex) { Console.WriteLine("{0}", ex.Message.ToString()); } } else { MessageBox.Show("'Telegram Bot' cannot be empty!"); } }