public async Task <GDAccount> getGJUserInfoAsync(string accID) { var getUserValues = new Dictionary <string, string> { { "gameVersion", "21" }, { "binaryVersion", "35" }, { "gdw", "0" }, { "accountID", _coreLib.GetGDAccID() }, { "gjp", _coreLib.GetGJP() }, { "targetAccountID", accID }, { "secret", gjSecret } }; FormUrlEncodedContent getUserContent = new FormUrlEncodedContent(getUserValues); HttpResponseMessage getUserResponse = await _client.PostAsync("http://boomlings.com/database/getGJUserInfo20.php", getUserContent); string getUserResponseString = await getUserResponse.Content.ReadAsStringAsync(); string[] finalResult = getUserResponseString.Split(':'); GDAccount acc = new GDAccount { youtubeUrl = finalResult[27], twitterUrl = finalResult[53], twitchUrl = finalResult[55], stars = finalResult[13], diamonds = finalResult[15], userCoins = finalResult[7], coins = finalResult[5], demons = finalResult[17], creatorPoints = finalResult[19] }; return(acc); }
public async Task GDProfileCmd([Remainder] string strInput = null) { GDAccount[] accounts = await _gdLib.GetGJUsersAsync(strInput); if (accounts == null) { await ReplyAsync("", embed : _lib.CreateEmbedWithError("Geometry Dash Commands Error", ":x: Could not find a user with this username.")); return; } GDAccount account = accounts[0]; EmbedBuilder builder = _lib.SetupEmbedWithDefaults(); string gdLogoUrl = gdThumbPic; builder.ThumbnailUrl = gdLogoUrl; builder.AddField("Username", account.username, true); builder.AddField("Stars", account.stars, true); builder.AddField("Diamonds", account.diamonds, true); builder.AddField("User Coins", account.userCoins, true); builder.AddField("Coins", account.coins, true); builder.AddField("Demons", account.demons, true); builder.AddField("Creator Points", account.creatorPoints, true); if (!string.IsNullOrEmpty(account.youtubeUrl)) { builder.AddField("YouTube", "[YouTube](https://www.youtube.com/channel/" + account.youtubeUrl + ")", true); } else { builder.AddField("YouTube", "None", true); } if (!string.IsNullOrEmpty(account.twitchUrl)) { builder.AddField("Twitch", $"[{account.twitchUrl}](https://twitch.tv/" + account.twitchUrl + ")", true); } else { builder.AddField("Twitch", "None", true); } if (!string.IsNullOrEmpty(account.twitterUrl)) { builder.AddField("Twitter", $"[@{account.twitterUrl}](https://www.twitter.com/@" + account.twitterUrl + ")", true); } else { builder.AddField("Twitter", "None", true); } GDComment comment = await _gdLib.GetMostRecentComment(account.accountID); if (comment != null) { builder.AddField("Most Recent Account Comment", comment.comment + " | " + comment.likes + " likes"); } EmbedFooterBuilder embedFooterBuilder = new EmbedFooterBuilder { Text = $"User ID: {account.userID}, Account ID: {account.accountID}", IconUrl = gdLogoUrl }; builder.Footer = embedFooterBuilder; await ReplyAsync("", embed : builder.Build()); }
public async Task <GDAccount[]> GetGJUsersAsync(string strInput) { var gjUsersDict = new Dictionary <string, string> { { "gameVersion", "21" }, { "binaryVersion", "35" }, { "gdw", "0" }, { "str", strInput }, { "total", "0" }, { "page", "0" }, { "secret", gjSecret } }; FormUrlEncodedContent gjUsersContent = new FormUrlEncodedContent(gjUsersDict); HttpResponseMessage gjUsersResponse = await _client.PostAsync("http://boomlings.com/database/getGJUsers20.php", gjUsersContent); string responseString = await gjUsersResponse.Content.ReadAsStringAsync(); if (responseString == "-1") { return(null); } string[] accountStrings = responseString.Split('|'); int arrayLength = 0; GDAccount[] accounts = new GDAccount[10]; foreach (string str in accountStrings) { if (string.IsNullOrEmpty(str)) { continue; } string[] accountInfo = str.Split(':'); GDAccount userInfo = await getGJUserInfoAsync(accountInfo[21]); GDAccount acc = new GDAccount { accountID = accountInfo[21], userID = accountInfo[3], username = accountInfo[1], stars = userInfo.stars, diamonds = userInfo.diamonds, userCoins = userInfo.userCoins, coins = userInfo.coins, demons = userInfo.demons, creatorPoints = userInfo.creatorPoints, youtubeUrl = userInfo.youtubeUrl, twitterUrl = userInfo.twitterUrl, twitchUrl = userInfo.twitchUrl }; accounts[arrayLength] = acc; arrayLength++; } return(accounts); }