diff --git a/events/modals/denyreasonbox.js b/events/modals/denyreasonbox.js index 854cc73..0cea7a8 100644 --- a/events/modals/denyreasonbox.js +++ b/events/modals/denyreasonbox.js @@ -23,7 +23,11 @@ module.exports = { const embed = message.embeds[0]; const applicantId = embed.footer.text.split(" ")[1]; - const applicant = await guild.members.fetch(applicantId); + try { + var applicant = await guild.members.fetch(applicantId); + } catch (error) { + var applicant = null; + } const reason = interaction.fields.fields.get('denyreason').value || "No reason provided"; const embedColor = Number(color.replace("#", "0x")); @@ -71,11 +75,11 @@ module.exports = { text: "ID: " + applicant.id }) - if (applicant) { + if (applicant !== null) { await applicant.send({ embeds: [dmMessage] }); } - if (!applicant) { + if (applicant === null) { var responseEmbeds = [responseEmbed, missingUser]; } else { var responseEmbeds = [responseEmbed];