2024-09-29 17:01:25 +00:00
|
|
|
const { MessageActionRow, MessageButton, MessageEmbed, TextInputComponent } = require('discord.js');
|
2024-09-26 03:22:22 +00:00
|
|
|
|
2024-09-25 22:56:33 +00:00
|
|
|
module.exports = {
|
2024-09-26 23:30:41 +00:00
|
|
|
actionRows: {
|
|
|
|
gifSearchAR(state) {
|
|
|
|
// Setup the buttons
|
|
|
|
const previousButton = new MessageButton()
|
2024-09-25 22:56:33 +00:00
|
|
|
.setCustomId('prevGif')
|
|
|
|
.setLabel('⬅️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
const confirmButton = new MessageButton()
|
2024-09-25 22:56:33 +00:00
|
|
|
.setCustomId('confirmGif')
|
2024-09-26 23:30:41 +00:00
|
|
|
.setLabel('Select')
|
2024-09-25 22:56:33 +00:00
|
|
|
.setStyle('PRIMARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
const nextButton = new MessageButton()
|
2024-09-25 22:56:33 +00:00
|
|
|
.setCustomId('nextGif')
|
|
|
|
.setLabel('➡️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
const cancelButton = new MessageButton()
|
2024-09-25 22:56:33 +00:00
|
|
|
.setCustomId('cancelGif')
|
2024-09-26 23:30:41 +00:00
|
|
|
.setLabel('Cancel')
|
2024-09-25 22:56:33 +00:00
|
|
|
.setStyle('DANGER');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case 'first':
|
2024-09-26 03:22:22 +00:00
|
|
|
previousButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
case 'last':
|
2024-09-26 03:22:22 +00:00
|
|
|
nextButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Put the buttons into an ActionRow
|
|
|
|
return new MessageActionRow()
|
2024-09-26 03:22:22 +00:00
|
|
|
.addComponents(previousButton, confirmButton, nextButton, cancelButton);
|
2024-09-26 23:30:41 +00:00
|
|
|
},
|
|
|
|
gifsPageAR(state) {
|
|
|
|
// Setup the buttons
|
|
|
|
const previousButton = new MessageButton()
|
2024-09-26 03:22:22 +00:00
|
|
|
.setCustomId('prevGifsPage')
|
|
|
|
.setLabel('⬅️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
const nextButton = new MessageButton()
|
2024-09-26 03:22:22 +00:00
|
|
|
.setCustomId('nextGifsPage')
|
|
|
|
.setLabel('➡️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case 'first':
|
2024-09-26 12:09:09 +00:00
|
|
|
previousButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
case 'last':
|
2024-09-26 12:09:09 +00:00
|
|
|
nextButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Put the buttons into an ActionRow
|
|
|
|
return new MessageActionRow()
|
2024-09-26 03:22:22 +00:00
|
|
|
.addComponents(previousButton, nextButton);
|
2024-09-26 23:30:41 +00:00
|
|
|
},
|
|
|
|
requestsPageAR(state) {
|
|
|
|
// Setup the buttons
|
|
|
|
const previousButton = new MessageButton()
|
2024-09-26 03:22:22 +00:00
|
|
|
.setCustomId('prevRequestsPage')
|
|
|
|
.setLabel('⬅️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
const nextButton = new MessageButton()
|
2024-09-26 03:22:22 +00:00
|
|
|
.setCustomId('nextRequestsPage')
|
|
|
|
.setLabel('➡️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-29 17:01:25 +00:00
|
|
|
|
|
|
|
const closeButton = new MessageButton()
|
|
|
|
.setCustomId('closeRequests')
|
|
|
|
.setLabel('Close Requests')
|
|
|
|
.setStyle('DANGER');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case 'first':
|
2024-09-26 12:37:16 +00:00
|
|
|
previousButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
case 'last':
|
2024-09-26 12:37:16 +00:00
|
|
|
nextButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Put the buttons into an ActionRow
|
|
|
|
return new MessageActionRow()
|
2024-09-26 12:37:16 +00:00
|
|
|
.addComponents(previousButton, nextButton);
|
2024-09-26 23:30:41 +00:00
|
|
|
},
|
|
|
|
pastasPageAR(state) {
|
|
|
|
// Setup the buttons
|
|
|
|
const previousButton = new MessageButton()
|
2024-09-26 03:22:22 +00:00
|
|
|
.setCustomId('prevPastasPage')
|
|
|
|
.setLabel('⬅️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
const nextButton = new MessageButton()
|
2024-09-26 03:22:22 +00:00
|
|
|
.setCustomId('nextPastasPage')
|
|
|
|
.setLabel('➡️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case 'first':
|
2024-09-26 12:27:11 +00:00
|
|
|
previousButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
case 'last':
|
2024-09-26 12:27:11 +00:00
|
|
|
nextButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Put the buttons into an ActionRow
|
|
|
|
return new MessageActionRow()
|
2024-09-26 12:47:42 +00:00
|
|
|
.addComponents(previousButton, nextButton);
|
2024-09-26 23:30:41 +00:00
|
|
|
},
|
|
|
|
jointsPageAR(state) {
|
|
|
|
// Setup the buttons
|
|
|
|
const previousButton = new MessageButton()
|
2024-09-26 12:47:42 +00:00
|
|
|
.setCustomId('prevJointsPage')
|
|
|
|
.setLabel('⬅️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
const nextButton = new MessageButton()
|
2024-09-26 12:47:42 +00:00
|
|
|
.setCustomId('nextJointsPage')
|
|
|
|
.setLabel('➡️')
|
|
|
|
.setStyle('SECONDARY');
|
2024-09-26 23:30:41 +00:00
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case 'first':
|
2024-09-26 12:47:42 +00:00
|
|
|
previousButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
case 'last':
|
2024-09-26 12:47:42 +00:00
|
|
|
nextButton.setDisabled(true);
|
|
|
|
break;
|
2024-09-26 23:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Put the buttons into an ActionRow
|
|
|
|
return new MessageActionRow()
|
2024-09-26 12:27:11 +00:00
|
|
|
.addComponents(previousButton, nextButton);
|
2024-09-26 23:30:41 +00:00
|
|
|
}
|
|
|
|
},
|
2024-09-29 17:01:25 +00:00
|
|
|
modals: {
|
|
|
|
closeRequestsModal() {
|
|
|
|
const requestNumberInput = new TextInputComponent()
|
|
|
|
.setCustomId('requestNumber')
|
|
|
|
.setLabel('Request Number')
|
|
|
|
.setPlaceholder('420')
|
|
|
|
.setMinLength(1)
|
|
|
|
.setMaxLength(5)
|
|
|
|
.setStyle('SHORT')
|
|
|
|
.setRequired(true);
|
|
|
|
|
|
|
|
const actionRow = new MessageActionRow()
|
|
|
|
.addComponents([requestNumberInput]);
|
|
|
|
|
|
|
|
return new Modal()
|
|
|
|
.setTitle('Close Request')
|
|
|
|
.setDescription('Please enter the number of the request you would like to close.')
|
|
|
|
.addComponents([actionRow]);
|
|
|
|
}
|
|
|
|
},
|
2024-09-26 23:30:41 +00:00
|
|
|
core: {
|
|
|
|
gifSearch(commandData, indexedGifs) {
|
|
|
|
return new MessageEmbed()
|
|
|
|
.setColor('#0099ff')
|
|
|
|
.setTitle('GIF Search')
|
|
|
|
.setImage(indexedGifs.thisPage[0].media_formats.gif.url)
|
|
|
|
.setFooter({ text: `Page ${indexedGifs.pagesString}` })
|
|
|
|
.addFields(
|
|
|
|
{ name: 'Query', value: `"${indexedGifs.query}"`, inline: true },
|
|
|
|
{ name: 'Saving As', value: `${indexedGifs.gifName}.gif`, inline: true },
|
|
|
|
);
|
|
|
|
}
|
2024-09-25 22:56:33 +00:00
|
|
|
}
|
|
|
|
}
|