Esempio n. 1
0
        public async Task Check(SocketUser user, bool withHistory = false)
        {
            var guild      = Context.Guild;
            var strikeInfo = await strikeRepo.GetUser(guild.Id, user.Id);

            var sb = new StringBuilder();

            sb.AppendLine($"{Emotes.Magnifying} Moderation information for **{user.Username}**#{user.Discriminator} (ID:{user.Id}):");
            sb.AppendLine($"{Emotes.RedFlag} Strikes: **{strikeInfo.Strikes}**");

            var muteInfo = await muteRepo.GetUser(guild.Id, user.Id);

            sb.AppendLine($"{Emotes.Muted} Muted: **{(muteInfo.IsMuted ? "Yes" : "No")}**");
            if (muteInfo.IsMuted)
            {
                var until = muteInfo.MutedUntil == null ? "Indefinite" : Formatter.TimespanToString(muteInfo.MutedUntil.Value - DateTime.UtcNow);
                sb.AppendLine($"{Emotes.ZippedMouth} Mute Time Remaining: **{until}**");
            }

            if (withHistory)
            {
                if (strikeInfo.StrikeMetadata.Any())
                {
                    sb.AppendLine($"{Emotes.RedBook} Latest strike history:");
                    var history = GetHistory(user, 5, "strike", strikeInfo.StrikeMetadata, guild);
                    sb.AppendLine(history);
                }
                if (strikeInfo.PardonMetadata.Any())
                {
                    sb.AppendLine($"{Emotes.GreenBook} Latest pardon history:");
                    var history = GetHistory(user, 5, "pardon", strikeInfo.PardonMetadata, guild);
                    sb.AppendLine(history);
                }
                if (!strikeInfo.StrikeMetadata.Any() && !strikeInfo.PardonMetadata.Any())
                {
                    sb.AppendLine($"{Emotes.BlueBook} No strike history found");
                }
            }
            await ReplyAsync(sb.ToString());
        }