(page)
| 67 | let currentPage = 1; |
| 68 | |
| 69 | const createCasesEmbed = (page) => { |
| 70 | const startIndex = (page - 1) * CASES_PER_PAGE; |
| 71 | const endIndex = startIndex + CASES_PER_PAGE; |
| 72 | const pageCases = cases.slice(startIndex, endIndex); |
| 73 | |
| 74 | const embed = createEmbed({ |
| 75 | title: 'Moderation Cases', |
| 76 | description: `Showing moderation cases for **${interaction.guild.name}**\n\n**Page ${page} of ${totalPages}**` |
| 77 | }); |
| 78 | |
| 79 | pageCases.forEach(case_ => { |
| 80 | const date = new Date(case_.createdAt).toLocaleDateString(); |
| 81 | const time = new Date(case_.createdAt).toLocaleTimeString(); |
| 82 | |
| 83 | embed.addFields({ |
| 84 | name: `Case #${case_.caseId} - ${case_.action}`, |
| 85 | value: `**Target:** ${case_.target}\n**Moderator:** ${case_.executor}\n**Date:** ${date} at ${time}\n**Reason:** ${case_.reason || 'No reason provided'}`, |
| 86 | inline: false |
| 87 | }); |
| 88 | }); |
| 89 | |
| 90 | embed.setFooter({ |
| 91 | text: `Total cases: ${cases.length} | Filter: ${filterType}${targetUser ?` | User: ${targetUser.tag}`: ''}` |
| 92 | }); |
| 93 | |
| 94 | return embed; |
| 95 | }; |
| 96 | |
| 97 | const createNavigationRow = (page) => { |
| 98 | const row = new ActionRowBuilder(); |
no test coverage detected