nodbot/CustomModules/Embeds.js

154 lines
5.1 KiB
JavaScript
Raw Permalink Normal View History

const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js');
2024-09-25 22:56:33 +00:00
module.exports = {
actionRows: {
gifSearchAR(state) {
// Setup the buttons
const previousButton = new MessageButton()
2024-09-25 22:56:33 +00:00
.setCustomId('prevGif')
.setLabel('⬅️')
.setStyle('SECONDARY');
const confirmButton = new MessageButton()
2024-09-25 22:56:33 +00:00
.setCustomId('confirmGif')
.setLabel('Select')
2024-09-25 22:56:33 +00:00
.setStyle('PRIMARY');
const nextButton = new MessageButton()
2024-09-25 22:56:33 +00:00
.setCustomId('nextGif')
.setLabel('➡️')
.setStyle('SECONDARY');
const cancelButton = new MessageButton()
2024-09-25 22:56:33 +00:00
.setCustomId('cancelGif')
.setLabel('Cancel')
2024-09-25 22:56:33 +00:00
.setStyle('DANGER');
switch (state) {
case 'first':
previousButton.setDisabled(true);
break;
case 'last':
nextButton.setDisabled(true);
break;
}
// Put the buttons into an ActionRow
return new MessageActionRow()
.addComponents(previousButton, confirmButton, nextButton, cancelButton);
},
gifsPageAR(state) {
// Setup the buttons
const previousButton = new MessageButton()
.setCustomId('prevGifsPage')
.setLabel('⬅️')
.setStyle('SECONDARY');
const nextButton = new MessageButton()
.setCustomId('nextGifsPage')
.setLabel('➡️')
.setStyle('SECONDARY');
switch (state) {
case 'first':
2024-09-26 12:09:09 +00:00
previousButton.setDisabled(true);
break;
case 'last':
2024-09-26 12:09:09 +00:00
nextButton.setDisabled(true);
break;
}
// Put the buttons into an ActionRow
return new MessageActionRow()
.addComponents(previousButton, nextButton);
},
requestsPageAR(state) {
// Setup the buttons
const previousButton = new MessageButton()
.setCustomId('prevRequestsPage')
.setLabel('⬅️')
.setStyle('SECONDARY');
const nextButton = new MessageButton()
.setCustomId('nextRequestsPage')
.setLabel('➡️')
.setStyle('SECONDARY');
switch (state) {
case 'first':
2024-09-26 12:37:16 +00:00
previousButton.setDisabled(true);
break;
case 'last':
2024-09-26 12:37:16 +00:00
nextButton.setDisabled(true);
break;
}
// Put the buttons into an ActionRow
return new MessageActionRow()
2024-09-26 12:37:16 +00:00
.addComponents(previousButton, nextButton);
},
pastasPageAR(state) {
// Setup the buttons
const previousButton = new MessageButton()
.setCustomId('prevPastasPage')
.setLabel('⬅️')
.setStyle('SECONDARY');
const nextButton = new MessageButton()
.setCustomId('nextPastasPage')
.setLabel('➡️')
.setStyle('SECONDARY');
switch (state) {
case 'first':
2024-09-26 12:27:11 +00:00
previousButton.setDisabled(true);
break;
case 'last':
2024-09-26 12:27:11 +00:00
nextButton.setDisabled(true);
break;
}
// Put the buttons into an ActionRow
return new MessageActionRow()
2024-09-26 12:47:42 +00:00
.addComponents(previousButton, nextButton);
},
jointsPageAR(state) {
// Setup the buttons
const previousButton = new MessageButton()
2024-09-26 12:47:42 +00:00
.setCustomId('prevJointsPage')
.setLabel('⬅️')
.setStyle('SECONDARY');
const nextButton = new MessageButton()
2024-09-26 12:47:42 +00:00
.setCustomId('nextJointsPage')
.setLabel('➡️')
.setStyle('SECONDARY');
switch (state) {
case 'first':
2024-09-26 12:47:42 +00:00
previousButton.setDisabled(true);
break;
case 'last':
2024-09-26 12:47:42 +00:00
nextButton.setDisabled(true);
break;
}
// Put the buttons into an ActionRow
return new MessageActionRow()
2024-09-26 12:27:11 +00:00
.addComponents(previousButton, nextButton);
}
},
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
}
}