public async Task ShowLastForms(int records = 5) { if (records <= 0) { await _replyservice.ReplyEmbedAsync(context : Context, message : "The number of selected records must be positive."); return; } var forms = VerificationFormDataHandler.GetVerificationFormsByGuild(Context.Guild.Id, records); var embed = new EmbedBuilder { Author = new EmbedAuthorBuilder { Name = $"Showing last {forms.Count} verification forms", IconUrl = Context.Client.CurrentUser.GetAvatarUrl() }, Color = Color.Blue, Timestamp = DateTimeOffset.UtcNow }; foreach (var form in forms) { var field = new EmbedFieldBuilder { Name = Context.Guild.GetUser(form.Verified).Username, Value = $"Verified by {form.Verifier} at {form.IssuedUtc} UTC.\n" + (form.IsApproved.HasValue ? (form.IsApproved.Value ? "Approved" : "Denied") + $"by { form.Approver } at {form.ApprovedUtc} UTC." : "Pending approval...") }; embed.AddField(field); } await _replyservice.ReplyEmbedAsync(Context, embed); }
public async Task ShowVerificatorLeaderboard() { var forms = VerificationFormDataHandler.GetVerificationFormsByGuild(Context.Guild.Id); var groups = forms.GroupBy(x => x.Verifier).OrderByDescending(x => x.Count()); var embed = new EmbedBuilder { Author = new EmbedAuthorBuilder { Name = $"Showing verification leaderboard", IconUrl = Context.Client.CurrentUser.GetAvatarUrl() }, Color = Color.Blue, Timestamp = DateTimeOffset.UtcNow }; foreach (var group in groups) { var user = Context.Guild.GetUser(group.Key); string usernameString = $"User Not Found (ID {group.Key.ToString()})"; if (user != null) { usernameString = user.Nickname ?? user.Username; } var field = new EmbedFieldBuilder() { Name = usernameString, Value = group.Count() }; embed.AddField(field); } await _replyservice.ReplyEmbedAsync(Context, embed); }