public async Task <GDComment> GetMostRecentComment(string accID) { if (string.IsNullOrEmpty(accID)) { return(null); } var mostLikedCommentValues = new Dictionary <string, string> { { "gameVersion", "21" }, { "binaryVersion", "35" }, { "gdw", "0" }, { "accountID", accID }, { "page", "0" }, { "total", "0" }, { "secret", gjSecret } }; FormUrlEncodedContent content = new FormUrlEncodedContent(mostLikedCommentValues); HttpResponseMessage response = await _client.PostAsync("http://boomlings.com/database/getGJAccountComments20.php", content); string responseString = await response.Content.ReadAsStringAsync(); if (string.IsNullOrEmpty(responseString)) { return(null); } /* This seems to be returned when the user is banned or disabled. */ if (responseString == "#0:0:10") { return(null); } string[] mem = responseString.Split('|'); string single = mem[0]; string[] contents = single.Split('~'); string decoded; try { decoded = _lib.DecodeB64(contents[1]); } catch { return(null); } GDComment comment = new GDComment { comment = decoded, likes = contents[3] }; return(comment); }
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()); }