Skip to content

Commit b5f02b0

Browse files
committed
Fix: Checking for empty content
1 parent a8a2036 commit b5f02b0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/commands/moderation/prefixCommands/functions/setContent.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,21 @@ export async function handleSetPrefixCommandContent(interaction: ChatInputComman
166166
time: 120000,
167167
});
168168

169+
title = modalSubmitInteraction.fields.getTextInputValue('commandContentTitle').trim();
170+
content = modalSubmitInteraction.fields.getTextInputValue('commandContentContent').trim();
171+
image = modalSubmitInteraction.fields.getTextInputValue('commandContentImageUrl').trim();
172+
173+
if (!title && !content && !image) {
174+
await modalSubmitInteraction.reply({
175+
content: 'You did not provide any content information and the change was not made.',
176+
ephemeral: true,
177+
});
178+
return;
179+
}
169180
await modalSubmitInteraction.reply({
170181
content: 'Processing command content data.',
171182
ephemeral: true,
172183
});
173-
174-
title = modalSubmitInteraction.fields.getTextInputValue('commandContentTitle').trim();
175-
content = modalSubmitInteraction.fields.getTextInputValue('commandContentContent').trim();
176-
image = modalSubmitInteraction.fields.getTextInputValue('commandContentImageUrl').trim();
177184
} catch (error) {
178185
//Handle the error if the user does not respond in time
179186
Logger.error(error);

0 commit comments

Comments
 (0)