Untitled
unknown
plain_text
a year ago
3.3 kB
9
Indexable
run: async({ interaction }) => {
const modal = new ModalBuilder({
customId: `verif-${interaction.user.id}`,
title: "Verify"
})
const email = new TextInputBuilder({
customId: 'emailinput',
label: 'Please enter your e-mail!',
style: TextInputStyle.Short,
required: true,
max_length:320
});
const first_action_Row = new ActionRowBuilder().addComponents(email);
modal.addComponents(first_action_Row);
await interaction.showModal(modal);
const filter = (interaction) => interaction.customId === `verif-${interaction.user.id}`;
try {
interaction.awaitModalSubmit({filter, time: 60_000}).then(async(modalInteraction) => {
const email_value = modalInteraction.fields.getTextInputValue(`emailinput`);
if(!isValidEmail(email_value)){
await modalInteraction.reply({content: "📛 Invalid email was provided!", ephemeral: true});
} else {
RequestPinCode(email_value).then(async(result) => {
if(result){
const pincode = new ButtonBuilder()
.setCustomId('pincode')
.setLabel('✅ Confirm')
.setStyle(ButtonStyle.Secondary);
const btn_row = new ActionRowBuilder()
.addComponents(pincode);
const response = await modalInteraction.reply({content: "✅ E-Mail containing your one time use pincode has been sent!", ephemeral: true, components: [btn_row]}).catch(e => {
console.log(e);
});
const collector = response.createMessageComponentCollector({
componentType: ComponentType.Button,
});
collector.on('collect', (interaction_btn) => {
console.log(interaction_btn);
if(interaction_btn.customId == "pincode"){
console.log('pincode wants to click');
return;
}
})
} else {
await modalInteraction.reply({content: "📛 The E-mail was not correct!", ephemeral: true}).catch(e => {
console.log(e);
});
}
}).catch(async(error) => {
await modalInteraction.reply({content: "⚠️ Hmm.. something went wrong, contact support if this issue persists!", ephemeral: true}).catch(e => {
console.log(e);
});
});
}
})
} catch(e){
// nothing
}
},Editor is loading...
Leave a Comment