public ScoreMessage(UserData userData, Score score) { // todo: put this in property get method. string rank = userData.statistics.global_rank.HasValue ? $"#{userData.statistics.global_rank.Value.Humanize()}" : "unranked"; EmbedBuilder = new EmbedBuilder() { Author = new EmbedAuthorBuilder() { Name = $"Played by {userData.username} ({rank})", IconUrl = userData.avatar_url, Url = $"https://osu.ppy.sh/users/{userData.id}/{score.mode}", }, Footer = new EmbedFooterBuilder() { Text = OsuModuleService.ModeStandardNames[score.mode], IconUrl = $"https://cdn.discordapp.com/emojis/{OsuModuleService.ModeEmoteIds[score.mode]}.png", }, Title = OsuModuleService.MakeScoreTitle(score), Description = OsuModuleService.MakeScoreDescription(score), ImageUrl = score.beatmapSet.covers.cover, Color = Color.LightGrey, Timestamp = score.created_at, }; }
public UserInfoMessage(UserData userData, Score[] bestScores) { string mode = bestScores.Length > 0 ? bestScores[0].mode : null; var fieldBuildersForScores = new List <EmbedFieldBuilder>(); foreach (Score score in bestScores) { fieldBuildersForScores.Add(new EmbedFieldBuilder() { Name = OsuModuleService.MakeScoreTitle(score), Value = OsuModuleService.MakeScoreDescription(score), }); } string rank = userData.statistics.global_rank.HasValue ? $"#{userData.statistics.global_rank.Value.Humanize()}" : "unranked"; EmbedBuilder = new EmbedBuilder() { Author = new EmbedAuthorBuilder() { Name = $"{userData.username} | {rank}", IconUrl = userData.avatar_url.StartsWith("http") ? userData.avatar_url : null, Url = $"https://osu.ppy.sh/users/{userData.id}", }, Footer = new EmbedFooterBuilder() { IconUrl = mode == null ? null : $"https://cdn.discordapp.com/emojis/{OsuModuleService.ModeEmoteIds[mode]}.png", Text = $"{(mode == null ? "osu!" : OsuModuleService.ModeStandardNames[mode])} • Joined: {DateTime.Parse(userData.join_date)}", }, Description = $"**Performance:** {Math.Round(userData.statistics.pp)}pp\n**Accuracy:** {Math.Round(userData.statistics.hit_accuracy, 2)}%\n**Time Played:** {userData.statistics.play_time / 3600}h", ImageUrl = userData.cover_url, Fields = fieldBuildersForScores, Color = Color.LightGrey, }; }