Ejemplo n.º 1
0
        public async Task GetModLogsForUserAsync(IUser user = null)
        {
            user = user ?? Context.User;

            var infractions = _moderation.GetAllUserInfractions(Context.Guild.Id, user.Id);
            var fields      = new List <EmbedField>();

            var embed = new EmbedBuilder()
            {
                Title = $"Modlogs for {user.Username}:",
                Color = Color.DarkBlue
            };

            for (int i = 0; i < infractions.Length; i++)
            {
                var restMod = await Context.Client.Rest.GetUserAsync(infractions[i].ModeratorId);

                fields.Add(new EmbedFieldBuilder()
                {
                    Name  = $"Case #{infractions[i].Id} | {infractions[i].Type.Humanize()} by {restMod.Username}",
                    Value = $"{infractions[i].Reason} | {infractions[i].Date.ToShortDateString()}\n\u200b"
                }
                           .Build());
            }

            await SendPaginatedMessageAsync(fields, null, embed);
        }