public static User GetMe(string apikey)
        {
#if DEBUG
            Console.WriteLine("\nGetting me [" + DateTime.Now + "]...\n");
#endif
            string json;
            {
                HttpWebRequest client = (HttpWebRequest)WebRequest.Create("https://api.telegram.org/bot" + apikey + "/getMe");
                try {
                    Stream data = client.GetResponse().GetResponseStream();
                    using (StreamReader reader = new StreamReader(data)) {
                        json = reader.ReadToEnd();
                    }
                } catch (WebException e) {
                    Notifications.log(e.ToString());
                    return(null);
                }
            }
#if DEBUG
            Console.WriteLine(JsonEnhancer.FormatJson(json));
#endif
            GetMeResponse response = JsonConvert.DeserializeObject <GetMeResponse>(json);
            return(response.Result);
        }
Exemple #2
0
 public GetMeResponse GetMe(GetMeRequest getMeRequest)
 {
     Log.Info(nameof(GetMe));
     return(GetMeResponse.Parse(ExecuteAction(getMeRequest)));
 }
Exemple #3
0
 public GetMeResponse GetMe(GetMeRequest getMeRequest)
 {
     return(GetMeResponse.Parse(ExecuteAction(getMeRequest)));
 }