Skip to content

Commit 30fe7b3

Browse files
committed
feat: remove note field if no note present
1 parent 65aa5d3 commit 30fe7b3

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

‎src/commands/bookmark.ts‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,6 @@ class ControlAddNoteModal extends Modal {
330330

331331
async run(interaction: ModalInteraction) {
332332
const note = interaction.fields.getText("bookmark-add-note-input");
333-
if (!note) {
334-
return interaction.reply({
335-
content: "You must provide a note.",
336-
});
337-
}
338333

339334
if (!interaction.message) return;
340335
const originalMessageEmbed = interaction.message.embeds[0];
@@ -347,14 +342,16 @@ class ControlAddNoteModal extends Modal {
347342

348343
const updatedEmbed = new Embed({
349344
...originalMessageEmbed.serialize(),
350-
fields: [
351-
...filteredFields,
352-
{
353-
name: `Note`,
354-
value: note,
355-
inline: false,
356-
},
357-
],
345+
fields: note
346+
? [
347+
...filteredFields,
348+
{
349+
name: `Note`,
350+
value: note,
351+
inline: false,
352+
},
353+
]
354+
: filteredFields,
358355
});
359356

360357
await interaction.message

0 commit comments

Comments
 (0)