Skylar Grant
3def31b0fb
All checks were successful
NodBot Production Dockerization / build (pull_request) Successful in 18s
154 lines
5.1 KiB
JavaScript
154 lines
5.1 KiB
JavaScript
const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js');
|
|
|
|
module.exports = {
|
|
actionRows: {
|
|
gifSearchAR(state) {
|
|
// Setup the buttons
|
|
const previousButton = new MessageButton()
|
|
.setCustomId('prevGif')
|
|
.setLabel('⬅️')
|
|
.setStyle('SECONDARY');
|
|
|
|
const confirmButton = new MessageButton()
|
|
.setCustomId('confirmGif')
|
|
.setLabel('Select')
|
|
.setStyle('PRIMARY');
|
|
|
|
const nextButton = new MessageButton()
|
|
.setCustomId('nextGif')
|
|
.setLabel('➡️')
|
|
.setStyle('SECONDARY');
|
|
|
|
const cancelButton = new MessageButton()
|
|
.setCustomId('cancelGif')
|
|
.setLabel('Cancel')
|
|
.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':
|
|
previousButton.setDisabled(true);
|
|
break;
|
|
case 'last':
|
|
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':
|
|
previousButton.setDisabled(true);
|
|
break;
|
|
case 'last':
|
|
nextButton.setDisabled(true);
|
|
break;
|
|
}
|
|
|
|
// Put the buttons into an ActionRow
|
|
return new MessageActionRow()
|
|
.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':
|
|
previousButton.setDisabled(true);
|
|
break;
|
|
case 'last':
|
|
nextButton.setDisabled(true);
|
|
break;
|
|
}
|
|
|
|
// Put the buttons into an ActionRow
|
|
return new MessageActionRow()
|
|
.addComponents(previousButton, nextButton);
|
|
},
|
|
jointsPageAR(state) {
|
|
// Setup the buttons
|
|
const previousButton = new MessageButton()
|
|
.setCustomId('prevJointsPage')
|
|
.setLabel('⬅️')
|
|
.setStyle('SECONDARY');
|
|
|
|
const nextButton = new MessageButton()
|
|
.setCustomId('nextJointsPage')
|
|
.setLabel('➡️')
|
|
.setStyle('SECONDARY');
|
|
|
|
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, 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 },
|
|
);
|
|
}
|
|
}
|
|
} |