MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / handleClearNotes

Function handleClearNotes

src/commands/Moderation/usernotes.js:239–266  ·  view source on GitHub ↗
(interaction, targetUser, notes, guildId)

Source from the content-addressed store, hash-verified

237}
238
239async function handleClearNotes(interaction, targetUser, notes, guildId) {
240 const noteCount = notes.length;
241
242 if (noteCount === 0) {
243 return InteractionHelper.safeReply(interaction, {
244 embeds: [
245 infoEmbed(
246 "No Notes to Clear",
247 `There are no notes for **${targetUser.tag}** to clear.`
248 ),
249 ],
250 });
251 }
252
253 notes.length = 0;
254
255 const notesKey = getUserNotesKey(guildId, targetUser.id);
256 await setInDb(notesKey, notes);
257
258 return InteractionHelper.safeReply(interaction, {
259 embeds: [
260 successEmbed(
261 "🗑️ Notes Cleared",
262 `Cleared **${noteCount}** notes from **${targetUser.tag}**.`
263 )
264 ]
265 });
266}
267
268function getNoteTypeInfo(type) {
269 const types = {

Callers 1

executeFunction · 0.85

Calls 5

infoEmbedFunction · 0.90
setInDbFunction · 0.90
successEmbedFunction · 0.90
getUserNotesKeyFunction · 0.85
safeReplyMethod · 0.80

Tested by

no test coverage detected