[Command("a")]
public async Task AdminsOnline()
{
using (WebClient client = new WebClient())
{
string[] admins = new string[]
{
"https://net4game.com/user/64596-roflmao/?tab=chars",
"https://net4game.com/user/122891-gokupl/?tab=chars",
"https://net4game.com/user/101376-grigor/?tab=chars",
"https://net4game.com/user/125252-lenkaa/?tab=chars",
"https://net4game.com/user/154539-darenty/?tab=chars",
"https://net4game.com/user/141674-tajemniczaa/?tab=chars",
"https://net4game.com/user/100757-mikeros/?tab=chars",
"https://net4game.com/user/30093-kozji/?tab=chars",
"https://net4game.com/user/111922-lisiek/?tab=chars",
"https://net4game.com/user/152909-herix/?tab=chars",
"https://net4game.com/user/161113-geast/?tab=chars",
"https://net4game.com/user/130107-pablou/?tab=chars",
"https://net4game.com/user/140404-mikuśka/?tab=chars",
"https://net4game.com/user/151407-rudzia/?tab=chars",
"https://net4game.com/user/88068-aktimel/?tab=chars",
"https://net4game.com/user/159329-seeba/?tab=chars",
"https://net4game.com/user/125076-peres12/?tab=chars",
"https://net4game.com/user/55998-theluceek/?tab=chars",
"https://net4game.com/user/162955-robxrt/?tab=chars"
};
int count = 0;
string getBetween(string strSource, string strStart, string strEnd)
{
int Start, End;
if (strSource.Contains(strStart) && strSource.Contains(strEnd))
{
Start = strSource.IndexOf(strStart, 0) + strStart.Length;
End = strSource.IndexOf(strEnd, Start);
return strSource.Substring(Start, End - Start);
}
else
{
return "";
}
}
string[] online = new string[19];
string htmlcodes;
string text = String.Format("Na serwerze znajduje się **{0}** GameMasterów.", count);
for (int i=0; i<19; i++)
{
htmlcodes = client.DownloadString(admins[i]);
string data = getBetween(htmlcodes, "<span class='hnick'>GM", "</span></a></li>");
Console.WriteLine(i);
Console.WriteLine(data);
if (data.Contains("on-line"))
{
count++;
online[i] = data;
}
if(count != 0)
{
text = String.Format("{0}\n\n{1}", text, online);
}
}
var embed = new EmbedBuilder();
embed.WithTitle("Rezultat wyszukiwania GM");
embed.WithDescription(text);
Context.Channel.SendMessageAsync("", false, embed);
/*string[] htmlcodes;
htmlcodes = new string[18];
string text;
for(int i=0; i<18; i++)
{
text = String.Format("{0}", admins[i]);
htmlcodes[i] = client.DownloadString(text);
if (htmlcodes[i].Contains("new_post.png"))
{
Context.Channel.SendMessageAsync(":unamused: Niestety, GMy są na serwerze.");
return;
}
Console.WriteLine(i);
Thread.Sleep(500);
}*/
//Context.Channel.SendMessageAsync(":blush: Nie ma GMów, miłego szkodnikowania!");
}