public async Task Warns(CommandContext ctx, [RemainingText] string suffix) { List <ulong> userIds = string.IsNullOrWhiteSpace(suffix) ? new List <ulong>() { ctx.User.Id } : Utils.GetIdListFromMessage(ctx.Message.MentionedUsers, suffix); if (userIds.Count == 0) { await CTX.RespondSanitizedAsync(ctx, "Please mention or type a user ID."); return; } if (ctx.Guild.Members.ContainsKey(userIds[0])) { RequireAdminAttribute adminCheck = new RequireAdminAttribute("Only server admins are allowed to view warnings of other users."); if (ctx.User.Id != userIds[0] && !await adminCheck.ExecuteCheckAsync(ctx, false)) { return; } DiscordEmbedBuilder warnEmbed = Utils.BaseEmbedBuilder(ctx, $"Warnings for {ctx.Guild.Members[userIds[0]].DisplayName} ({userIds[0]})", ctx.Guild.Members[userIds[0]].AvatarUrl, null, ctx.Guild.Members[userIds[0]].Color); var warns = ShimakazeBot.DbCtx.GuildWarn.Where(g => g.UserId == userIds[0] && g.GuildId == ctx.Guild.Id ).ToList(); if (warns.Count() == 0) { warnEmbed.WithDescription($"{ctx.Guild.Members[userIds[0]].DisplayName} has no warnings."); } else { warns.ForEach(item => warnEmbed.AddField(item.TimeStamp.ToString(), item.WarnMessage.Length > 1024 ? $"{item.WarnMessage.Take(1021)}..." : item.WarnMessage)); } await CTX.RespondSanitizedAsync(ctx, null, false, warnEmbed); } else { int id = (int)userIds[0]; GuildWarn warn = await ShimakazeBot.DbCtx.GuildWarn.FindAsync(id); if (warn != null) { await CTX.RespondSanitizedAsync(ctx, $"{warn.TimeStamp} - {warn.WarnMessage}"); } else { await CTX.RespondSanitizedAsync(ctx, $"Unable to find member or ID **{id}**"); } } }