feat: add validation to prevent both PDF file and URL being provided simultaneously
This commit is contained in:
@@ -26,6 +26,11 @@ class PdfHandler {
|
|||||||
const urlOption = interaction.options.getString('url');
|
const urlOption = interaction.options.getString('url');
|
||||||
const isPublic = interaction.options.getBoolean('public') === true;
|
const isPublic = interaction.options.getBoolean('public') === true;
|
||||||
|
|
||||||
|
if (attachment && urlOption) {
|
||||||
|
await interaction.editReply({ content: '❌ Fournis soit un fichier PDF, soit une URL, mais pas les deux.' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const sourceUrl = attachment ? attachment.url : urlOption;
|
const sourceUrl = attachment ? attachment.url : urlOption;
|
||||||
if (!attachment && !urlOption) {
|
if (!attachment && !urlOption) {
|
||||||
await interaction.editReply({ content: '❌ Fournis un PDF (fichier) ou une URL https:// vers un PDF.' });
|
await interaction.editReply({ content: '❌ Fournis un PDF (fichier) ou une URL https:// vers un PDF.' });
|
||||||
|
|||||||
Reference in New Issue
Block a user