예제 #1
0
            private static async Task <Embed> GetKarmaEmbed(Karma karma, string username, int topCount, GuildHandler messageSource)
            {
                if (karma.Upvotes == 0 && karma.Downvotes == 0)
                {
                    return(new EmbedBuilder().WithTitle(":(").WithDescription($"{username} has yet to recieve any karma.").Build());
                }

                EmbedBuilder builder = new EmbedBuilder().
                                       WithTitle($"Karma for {username}").
                                       WithDescription($"```{karma.Upvotes} upvotes.\n{karma.Downvotes} downvotes.\n{karma.Total} total.```");



                builder.AddField(await GetTopMessage($"Top [count] message", (x, y) => y.Total - x.Total, karma.GetMessages(), topCount, messageSource));
                builder.AddField(await GetTopMessage($"Buttom [count] message", (x, y) => x.Total - y.Total, karma.GetMessages(), topCount, messageSource));

                builder.AddField(GetTopVoters((x, y) => y - x, karma.GetUpvotes(), $"{username} is most loved by..", "upvotes", "```No one :(```", topCount, messageSource));
                builder.AddField(GetTopVoters((x, y) => y - x, karma.GetDownvotes(), $"{username} is most hated by..", "downvotes", "```No one! :)```", topCount, messageSource));

                return(builder.Build());
            }