private static int CheckEventR1() { try { HttpWebRequest wc = WebRequest.CreateHttp("http://events.rewards1.com/socket.io.js"); wc.Method = "GET"; wc.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); HttpWebResponse wr = wc.GetResponse() as HttpWebResponse; return (int)wr.StatusCode; } catch (System.Net.WebException ex) { var resp = (HttpWebResponse)ex.Response; return (int)resp.StatusCode; } catch (Exception) { return -100; } } private static int CheckHpR1() { try { HttpWebRequest wc = WebRequest.CreateHttp("http://rewards1.com"); wc.Method = "GET"; wc.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); HttpWebResponse wr = wc.GetResponse() as HttpWebResponse; return (int)wr.StatusCode; } catch (System.Net.WebException ex) { var resp = (HttpWebResponse)ex.Response; return (int)resp.StatusCode; } catch (Exception) { return -100; } } private static int CheckAjaxR1() { try { HttpWebRequest wc = WebRequest.CreateHttp("http://rewards1.com/ajax/home.php?function=load&fp=0"); wc.Method = "GET"; wc.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); HttpWebResponse wr = wc.GetResponse() as HttpWebResponse; return (int)wr.StatusCode; } catch (System.Net.WebException ex) { var resp = (HttpWebResponse)ex.Response; return (int)resp.StatusCode; } catch (Exception) { return -100; } } /// /// DoR1Check - EXEC /// /// /// public static void DoR1Check(IUserMessage Context, string param) { IDisposable o = Context.Channel.EnterTypingState(); int code = CheckEventR1(); int code2 = CheckHpR1(); int codeAjax = CheckAjaxR1(); bool res = code < 400 && code2 < 400; bool res2 = codeAjax < 400; if (res) { EmbedBuilder builder = new EmbedBuilder(); builder.Color = Color.Green; builder.AddField("`R1 Main`", "Status-code: `" + code2 + "`"); builder.AddField("`R1 Events`", "Status-code: `" + code + "`"); builder.AddField("`R1 AJAX`", "Status-code: `" + codeAjax + "`"); builder.WithAuthor("Rewards1.com Status: Available"); builder.WithDescription("No problems are detected at this time."); builder.WithFooter("ArcadeCORE - RMSoftware.ModularBot"); Context.Channel.SendMessageAsync("", false, builder.Build()); o.Dispose(); } if (res & !res2) { EmbedBuilder builder = new EmbedBuilder(); builder.Color = Color.Orange; builder.AddField("`R1 Main`", "Status-code: `" + code2 + "`"); builder.AddField("`R1 Events`", "Status-code: `" + code + "`"); builder.AddField("`R1 AJAX`", "Status-code: `" + codeAjax + "`"); builder.WithAuthor("Rewards1.com Status: WARNING."); builder.WithDescription("Some portions of the site may not load correctly."); builder.WithFooter("ArcadeCORE - RMSoftware.ModularBot"); Context.Channel.SendMessageAsync("", false, builder.Build()); o.Dispose(); } if (!res) { EmbedBuilder builder = new EmbedBuilder(); builder.Color = Color.Red; builder.AddField("`R1 Main`", "Status-code: `" + code2 + "`"); builder.AddField("`R1 Events`", "Status-code: `" + code + "`"); builder.AddField("`R1 AJAX`", "Status-code: `" + codeAjax + "`"); builder.WithAuthor("Rewards1.com Status: Unavailable"); if(code >= 400) { builder.WithDescription("The R1 Events server is currently down. This will affect a major portion of the site."); } if(code2 >= 400) { builder.WithDescription("The entire site is currently down."); } builder.WithFooter("ArcadeCORE - RMSoftware.ModularBot"); Context.Channel.SendMessageAsync("", false, builder.Build()); o.Dispose(); } }