(interaction, targetUser, notes)
| 172 | } |
| 173 | |
| 174 | async function handleViewNotes(interaction, targetUser, notes) { |
| 175 | if (notes.length === 0) { |
| 176 | return InteractionHelper.safeReply(interaction, { |
| 177 | embeds: [ |
| 178 | infoEmbed( |
| 179 | "📝 No Notes", |
| 180 | `There are no notes for **${targetUser.tag}**.` |
| 181 | ), |
| 182 | ], |
| 183 | }); |
| 184 | } |
| 185 | |
| 186 | const sortedNotes = [...notes].sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp)); |
| 187 | |
| 188 | let description = `**Notes for ${targetUser.tag} (${targetUser.id}):**\n\n`; |
| 189 | |
| 190 | sortedNotes.forEach((note, index) => { |
| 191 | const typeInfo = getNoteTypeInfo(note.type); |
| 192 | const date = new Date(note.timestamp).toLocaleDateString(); |
| 193 | description += `${typeInfo.emoji} **Note #${index + 1}** (${note.type}) - ${date}\n`; |
| 194 | description += `> ${note.content}\n`; |
| 195 | description += `*Added by ${note.author}*\n\n`; |
| 196 | }); |
| 197 | |
| 198 | if (description.length > 4000) { |
| 199 | description = description.substring(0, 3900) + "\n... *(truncated)*"; |
| 200 | } |
| 201 | |
| 202 | return InteractionHelper.safeReply(interaction, { |
| 203 | embeds: [ |
| 204 | infoEmbed( |
| 205 | `📝 User Notes (${notes.length})`, |
| 206 | description |
| 207 | ) |
| 208 | ] |
| 209 | }); |
| 210 | } |
| 211 | |
| 212 | async function handleRemoveNote(interaction, targetUser, notes, guildId) { |
| 213 | const index = interaction.options.getInteger("index") - 1; |
no test coverage detected