Added dynamic labels and default values.
All checks were successful
NodBot PE Dockerization / build (push) Successful in 9s
All checks were successful
NodBot PE Dockerization / build (push) Successful in 9s
This commit is contained in:
parent
017eaddf9b
commit
80c23ca7db
44
functions.js
44
functions.js
@ -639,8 +639,9 @@ const functions = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
oneFieldModal(templateId, labels) {
|
oneFieldModal(templateId, labels, values) {
|
||||||
const fieldOneLabel = labels[0] ? labels[0] : 'Text Field:';
|
const fieldOneLabel = labels[0] ? labels[0] : 'Text Field:';
|
||||||
|
const fieldOneValue = values[0] ? values[0] : '';
|
||||||
// Create the modal
|
// Create the modal
|
||||||
const modal = new Modal()
|
const modal = new Modal()
|
||||||
.setCustomId('oneFieldMemeModal')
|
.setCustomId('oneFieldMemeModal')
|
||||||
@ -649,22 +650,25 @@ const functions = {
|
|||||||
const textInput = new TextInputComponent()
|
const textInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextField')
|
.setCustomId('memeTextField')
|
||||||
.setLabel(fieldOneLabel)
|
.setLabel(fieldOneLabel)
|
||||||
|
.setValue(fieldOneValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create and pre-fill a template ID field
|
// Create and pre-fill a template ID field
|
||||||
const templateIdField = new TextInputComponent()
|
const templateIdField = new TextInputComponent()
|
||||||
.setCustomId('memeTemplateId')
|
.setCustomId('memeTemplateId')
|
||||||
.setLabel('Template ID: (advanced)')
|
.setLabel('Template ID: (advanced)')
|
||||||
.setStyle('SHORT')
|
.setValue(templateId)
|
||||||
.setValue(templateId);
|
.setStyle('SHORT');
|
||||||
// Add the components to the modal
|
// Add the components to the modal
|
||||||
const textRow = new MessageActionRow().addComponents(textInput);
|
const textRow = new MessageActionRow().addComponents(textInput);
|
||||||
const templateIdRow = new MessageActionRow().addComponents(templateIdField);
|
const templateIdRow = new MessageActionRow().addComponents(templateIdField);
|
||||||
modal.addComponents(textRow, templateIdRow);
|
modal.addComponents(textRow, templateIdRow);
|
||||||
return modal;
|
return modal;
|
||||||
},
|
},
|
||||||
twoFieldModal(templateId, labels) {
|
twoFieldModal(templateId, labels, values) {
|
||||||
const fieldOneLabel = labels[0] ? labels[0] : 'Text Field 1:';
|
const fieldOneLabel = labels[0] ? labels[0] : 'Text Field 1:';
|
||||||
const fieldTwoLabel = labels[1] ? labels[1] : 'Text Field 2:';
|
const fieldTwoLabel = labels[1] ? labels[1] : 'Text Field 2:';
|
||||||
|
const fieldOneValue = values[0] ? values[0] : '';
|
||||||
|
const fieldTwoValue = values[1] ? values[1] : '';
|
||||||
// Create the modal
|
// Create the modal
|
||||||
const modal = new Modal()
|
const modal = new Modal()
|
||||||
.setCustomId('twoFieldMemeModal')
|
.setCustomId('twoFieldMemeModal')
|
||||||
@ -673,18 +677,20 @@ const functions = {
|
|||||||
const fieldOneTextInput = new TextInputComponent()
|
const fieldOneTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldOne')
|
.setCustomId('memeTextFieldOne')
|
||||||
.setLabel(fieldOneLabel)
|
.setLabel(fieldOneLabel)
|
||||||
|
.setValue(fieldOneValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create the second text input
|
// Create the second text input
|
||||||
const fieldTwoTextInput = new TextInputComponent()
|
const fieldTwoTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldTwo')
|
.setCustomId('memeTextFieldTwo')
|
||||||
.setLabel(fieldTwoLabel)
|
.setLabel(fieldTwoLabel)
|
||||||
|
.setValue(fieldTwoValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create and pre-fill a template ID field
|
// Create and pre-fill a template ID field
|
||||||
const templateIdField = new TextInputComponent()
|
const templateIdField = new TextInputComponent()
|
||||||
.setCustomId('memeTemplateId')
|
.setCustomId('memeTemplateId')
|
||||||
.setLabel('Template ID: (advanced)')
|
.setLabel('Template ID: (advanced)')
|
||||||
.setStyle('SHORT')
|
.setValue(templateId)
|
||||||
.setValue(templateId);
|
.setStyle('SHORT');
|
||||||
// Add the components to the modal
|
// Add the components to the modal
|
||||||
const fieldOneRow = new MessageActionRow().addComponents(fieldOneTextInput);
|
const fieldOneRow = new MessageActionRow().addComponents(fieldOneTextInput);
|
||||||
const fieldTwoRow = new MessageActionRow().addComponents(fieldTwoTextInput);
|
const fieldTwoRow = new MessageActionRow().addComponents(fieldTwoTextInput);
|
||||||
@ -692,10 +698,13 @@ const functions = {
|
|||||||
modal.addComponents(fieldOneRow, fieldTwoRow, templateIdRow);
|
modal.addComponents(fieldOneRow, fieldTwoRow, templateIdRow);
|
||||||
return modal;
|
return modal;
|
||||||
},
|
},
|
||||||
threeFieldModal(templateId, labels) {
|
threeFieldModal(templateId, labels, values) {
|
||||||
const fieldOneLabel = labels[0] ? labels[0] : 'Text Field 1:';
|
const fieldOneLabel = labels[0] ? labels[0] : 'Text Field 1:';
|
||||||
const fieldTwoLabel = labels[1] ? labels[1] : 'Text Field 2:';
|
const fieldTwoLabel = labels[1] ? labels[1] : 'Text Field 2:';
|
||||||
const fieldThreeLabel = labels[2] ? labels[2] : 'Text Field 3:';
|
const fieldThreeLabel = labels[2] ? labels[2] : 'Text Field 3:';
|
||||||
|
const fieldOneValue = values[0] ? values[0] : '';
|
||||||
|
const fieldTwoValue = values[1] ? values[1] : '';
|
||||||
|
const fieldThreeValue = values[2] ? values[2] : '';
|
||||||
// Create the modal
|
// Create the modal
|
||||||
const modal = new Modal()
|
const modal = new Modal()
|
||||||
.setCustomId('threeFieldMemeModal')
|
.setCustomId('threeFieldMemeModal')
|
||||||
@ -704,23 +713,26 @@ const functions = {
|
|||||||
const fieldOneTextInput = new TextInputComponent()
|
const fieldOneTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldOne')
|
.setCustomId('memeTextFieldOne')
|
||||||
.setLabel(fieldOneLabel)
|
.setLabel(fieldOneLabel)
|
||||||
|
.setValue(fieldOneValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create the second text input
|
// Create the second text input
|
||||||
const fieldTwoTextInput = new TextInputComponent()
|
const fieldTwoTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldTwo')
|
.setCustomId('memeTextFieldTwo')
|
||||||
.setLabel(fieldTwoLabel)
|
.setLabel(fieldTwoLabel)
|
||||||
|
.setValue(fieldTwoValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create the third text input
|
// Create the third text input
|
||||||
const fieldThreeTextInput = new TextInputComponent()
|
const fieldThreeTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldThree')
|
.setCustomId('memeTextFieldThree')
|
||||||
.setLabel(fieldThreeLabel)
|
.setLabel(fieldThreeLabel)
|
||||||
|
.setValue(fieldThreeValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create and pre-fill a template ID field
|
// Create and pre-fill a template ID field
|
||||||
const templateIdField = new TextInputComponent()
|
const templateIdField = new TextInputComponent()
|
||||||
.setCustomId('memeTemplateId')
|
.setCustomId('memeTemplateId')
|
||||||
.setLabel('Template ID: (advanced)')
|
.setLabel('Template ID: (advanced)')
|
||||||
.setStyle('SHORT')
|
.setValue(templateId)
|
||||||
.setValue(templateId);
|
.setStyle('SHORT');
|
||||||
// Add the components to the modal
|
// Add the components to the modal
|
||||||
const fieldOneRow = new MessageActionRow().addComponents(fieldOneTextInput);
|
const fieldOneRow = new MessageActionRow().addComponents(fieldOneTextInput);
|
||||||
const fieldTwoRow = new MessageActionRow().addComponents(fieldTwoTextInput);
|
const fieldTwoRow = new MessageActionRow().addComponents(fieldTwoTextInput);
|
||||||
@ -729,11 +741,15 @@ const functions = {
|
|||||||
modal.addComponents(fieldOneRow, fieldTwoRow, fieldThreeRow, templateIdRow);
|
modal.addComponents(fieldOneRow, fieldTwoRow, fieldThreeRow, templateIdRow);
|
||||||
return modal;
|
return modal;
|
||||||
},
|
},
|
||||||
fourFieldModal(templateId, labels) {
|
fourFieldModal(templateId, labels, values) {
|
||||||
const fieldOneLabel = labels[0] ? labels[0] : 'Text Field 1:';
|
const fieldOneLabel = labels[0] ? labels[0] : 'Text Field 1:';
|
||||||
const fieldTwoLabel = labels[1] ? labels[1] : 'Text Field 2:';
|
const fieldTwoLabel = labels[1] ? labels[1] : 'Text Field 2:';
|
||||||
const fieldThreeLabel = labels[2] ? labels[2] : 'Text Field 3:';
|
const fieldThreeLabel = labels[2] ? labels[2] : 'Text Field 3:';
|
||||||
const fieldFourLabel = labels[3] ? labels[3] : 'Text Field 4:';
|
const fieldFourLabel = labels[3] ? labels[3] : 'Text Field 4:';
|
||||||
|
const fieldOneValue = values[0] ? values[0] : '';
|
||||||
|
const fieldTwoValue = values[1] ? values[1] : '';
|
||||||
|
const fieldThreeValue = values[2] ? values[2] : '';
|
||||||
|
const fieldFourValue = values[3] ? values[3] : '';
|
||||||
// Create the modal
|
// Create the modal
|
||||||
const modal = new Modal()
|
const modal = new Modal()
|
||||||
.setCustomId('fourFieldMemeModal')
|
.setCustomId('fourFieldMemeModal')
|
||||||
@ -742,28 +758,32 @@ const functions = {
|
|||||||
const fieldOneTextInput = new TextInputComponent()
|
const fieldOneTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldOne')
|
.setCustomId('memeTextFieldOne')
|
||||||
.setLabel(fieldOneLabel)
|
.setLabel(fieldOneLabel)
|
||||||
|
.setValue(fieldOneValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create the second text input
|
// Create the second text input
|
||||||
const fieldTwoTextInput = new TextInputComponent()
|
const fieldTwoTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldTwo')
|
.setCustomId('memeTextFieldTwo')
|
||||||
.setLabel(fieldTwoLabel)
|
.setLabel(fieldTwoLabel)
|
||||||
|
.setValue(fieldTwoValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create the third text input
|
// Create the third text input
|
||||||
const fieldThreeTextInput = new TextInputComponent()
|
const fieldThreeTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldThree')
|
.setCustomId('memeTextFieldThree')
|
||||||
.setLabel(fieldThreeLabel)
|
.setLabel(fieldThreeLabel)
|
||||||
|
.setValue(fieldThreeValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create the fourth text input
|
// Create the fourth text input
|
||||||
const fieldFourTextInput = new TextInputComponent()
|
const fieldFourTextInput = new TextInputComponent()
|
||||||
.setCustomId('memeTextFieldFour')
|
.setCustomId('memeTextFieldFour')
|
||||||
.setLabel(fieldFourLabel)
|
.setLabel(fieldFourLabel)
|
||||||
|
.setValue(fieldFourValue)
|
||||||
.setStyle('SHORT');
|
.setStyle('SHORT');
|
||||||
// Create and pre-fill a template ID field
|
// Create and pre-fill a template ID field
|
||||||
const templateIdField = new TextInputComponent()
|
const templateIdField = new TextInputComponent()
|
||||||
.setCustomId('memeTemplateId')
|
.setCustomId('memeTemplateId')
|
||||||
.setLabel('Template ID: (advanced)')
|
.setLabel('Template ID: (advanced)')
|
||||||
.setStyle('SHORT')
|
.setValue(templateId)
|
||||||
.setValue(templateId);
|
.setStyle('SHORT');
|
||||||
// Add the components to the modal
|
// Add the components to the modal
|
||||||
const fieldOneRow = new MessageActionRow().addComponents(fieldOneTextInput);
|
const fieldOneRow = new MessageActionRow().addComponents(fieldOneTextInput);
|
||||||
const fieldTwoRow = new MessageActionRow().addComponents(fieldTwoTextInput);
|
const fieldTwoRow = new MessageActionRow().addComponents(fieldTwoTextInput);
|
||||||
|
|||||||
@ -28,29 +28,37 @@ module.exports = {
|
|||||||
switch (template) {
|
switch (template) {
|
||||||
// One-Field Memes
|
// One-Field Memes
|
||||||
// Two-Field Memes
|
// Two-Field Memes
|
||||||
case '181913649': // Y'all got any more of that
|
case '181913649': // Drake Hotline Bling
|
||||||
// Generate a modal with two text inputs
|
|
||||||
memeModal = fn.memes.twoFieldModal(template, ['Top Text', 'Bottom Text']);
|
|
||||||
await interaction.showModal(memeModal);
|
|
||||||
break;
|
|
||||||
case '124055727': // Drake Hotline Bling No/Yes
|
|
||||||
// Generate a modal with two text inputs
|
// Generate a modal with two text inputs
|
||||||
memeModal = fn.memes.twoFieldModal(template, ['Drake No', 'Drake Yes']);
|
memeModal = fn.memes.twoFieldModal(template, ['Drake No', 'Drake Yes']);
|
||||||
await interaction.showModal(memeModal);
|
await interaction.showModal(memeModal);
|
||||||
break;
|
break;
|
||||||
|
case '124055727': // Y'all Got Any More...
|
||||||
|
// Generate a modal with two text inputs
|
||||||
|
memeModal = fn.memes.twoFieldModal(template, ['Top', 'Bottom Text'], ['Y\'all got any more of ', '']);
|
||||||
|
await interaction.showModal(memeModal);
|
||||||
|
break;
|
||||||
case '217743513': // Uno Draw 25
|
case '217743513': // Uno Draw 25
|
||||||
// Generate a modal with two text inputs
|
// Generate a modal with two text inputs
|
||||||
memeModal = fn.memes.twoFieldModal(template, ['<blank> or draw 25', 'Caption Above Person']);
|
memeModal = fn.memes.twoFieldModal(template, ['<blank> or draw 25', 'Caption Above Person'], ['', 'Me']);
|
||||||
await interaction.showModal(memeModal);
|
await interaction.showModal(memeModal);
|
||||||
break;
|
break;
|
||||||
// Three-Field Memes
|
// Three-Field Memes
|
||||||
case '322841258': // Anakin & Padme
|
case '322841258': // Anakin & Padme
|
||||||
|
// Generate a modal with three text inputs
|
||||||
|
memeModal = fn.memes.threeFieldModal(template, ['Anakin', 'Padme', 'Padme'], ['', '', 'Right?']);
|
||||||
|
await interaction.showModal(memeModal);
|
||||||
|
break;
|
||||||
case '342785297': // We are not the same
|
case '342785297': // We are not the same
|
||||||
|
// Generate a modal with three text inputs
|
||||||
|
memeModal = fn.memes.threeFieldModal(template, ['You...', 'I...', 'We...'], ['', '', 'We are not the same.']);
|
||||||
|
await interaction.showModal(memeModal);
|
||||||
|
break;
|
||||||
case '155067746': // Surprised Pikachu
|
case '155067746': // Surprised Pikachu
|
||||||
case '87743020': // Two Buttons
|
case '87743020': // Two Buttons
|
||||||
// Generate a modal with three text inputs
|
// Generate a modal with three text inputs
|
||||||
const threeFieldMemeModal = fn.memes.threeFieldModal(template);
|
memeModal = fn.memes.threeFieldModal(template, ['Button 1', 'Button 2', 'Person Caption']);
|
||||||
await interaction.showModal(threeFieldMemeModal);
|
await interaction.showModal(memeModal);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
await interaction.reply('Invalid meme template');
|
await interaction.reply('Invalid meme template');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user