Skip to content

Commit

Permalink
ff
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewstech committed Jun 29, 2023
1 parent e454820 commit c888c93
Showing 1 changed file with 21 additions and 43 deletions.
64 changes: 21 additions & 43 deletions commands/sendemail.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,30 @@ module.exports = {
const emailSubject = interaction.options.getString("subject");
const modal = new ModalBuilder().setCustomId("sendemail").setTitle("Send Email");

// Add components to modal

// Create the text input components
let email;
let subject;
console.log(emailAddress);
console.log(emailSubject);
console.log(email);
console.log(subject);
if (emailAddress) {
email = new TextInputBuilder()
.setCustomId("email")
// The label is the prompt the user sees for this input
.setLabel("To email?")
.setValue(emailAddress)
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
modal.addComponents(new ActionRowBuilder().addComponents(email));
if (!emailAddress) {
const emailAddress = "email"
}
if (!emailSubject) {
const emailSubject = "subject"
}
else {
email = new TextInputBuilder()
.setCustomId("email")
// The label is the prompt the user sees for this input
.setLabel("To email?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short)
}

if (emailSubject) {

subject = new TextInputBuilder()
.setCustomId("subject")
.setLabel("What is the email subject?")
.setValue(emailSubject)
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Short);
}
else {
subject = new TextInputBuilder()
.setCustomId("subject")
.setLabel("What is the email subject?")
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Short);
}
// Create the text input components
const email = new TextInputBuilder()
.setCustomId("email")
// The label is the prompt the user sees for this input
.setLabel("To email?")
.setValue(emailAddress)
// Short means only a single line of text
.setStyle(TextInputStyle.Short)


const subject = new TextInputBuilder()
.setCustomId("subject")
.setLabel("What is the email subject?")
.setValue(emailSubject)
// Paragraph means multiple lines of text.
.setStyle(TextInputStyle.Short);

const message = new TextInputBuilder()
.setCustomId("message")
Expand All @@ -70,8 +50,6 @@ module.exports = {
const firstActionRow = new ActionRowBuilder().addComponents(email);
const secondActionRow = new ActionRowBuilder().addComponents(subject);
const thirdActionRow = new ActionRowBuilder().addComponents(message);
email = null;
subject = null;

// Add inputs to the modal
modal.addComponents(firstActionRow, secondActionRow, thirdActionRow);
Expand Down

0 comments on commit c888c93

Please sign in to comment.