v3.3.3: Paged Commands #20

Merged
voidf1sh merged 15 commits from v3.3.3 into main 2024-09-26 13:24:55 +00:00
2 changed files with 30 additions and 10 deletions
Showing only changes of commit e4c389be71 - Show all commits

28
CustomModules/Embeds.js Normal file
View File

@ -0,0 +1,28 @@
module.exports = {
gifSearchAR() {
// Setup the buttons
const previousButton = new MessageButton()
.setCustomId('prevGif')
.setLabel('⬅️')
.setStyle('SECONDARY');
const confirmButton = new MessageButton()
.setCustomId('confirmGif')
.setLabel('✅')
.setStyle('PRIMARY');
const nextButton = new MessageButton()
.setCustomId('nextGif')
.setLabel('➡️')
.setStyle('SECONDARY');
const cancelButton = new MessageButton()
.setCustomId('cancelGif')
.setLabel('❌')
.setStyle('DANGER');
// Put the buttons into an ActionRow
return new MessageActionRow()
.addComponents(previousButton, confirmButton, nextButton, cancelButton);
}
}

View File

@ -11,6 +11,7 @@ const { MessageActionRow, MessageButton } = require('discord.js');
const fn = require('../functions.js'); const fn = require('../functions.js');
const strings = require('../strings.json'); const strings = require('../strings.json');
const { GifData } = require('../CustomModules/NodBot.js'); const { GifData } = require('../CustomModules/NodBot.js');
const customEmbeds = require('../CustomModules/Embeds.js');
const { emoji } = strings; const { emoji } = strings;
module.exports = { module.exports = {
@ -142,16 +143,7 @@ module.exports = {
// GIF Search // GIF Search
case "gifsearch": case "gifsearch":
// TODO Check on option names // TODO Check on option names
// Previous GIF button const actionRow = customEmbeds.gifSearchAR();
const prevButton = new MessageButton().setCustomId('prevGif').setLabel('Previous GIF').setStyle('SECONDARY').setDisabled(true);
// Confirm GIF Button
const confirmButton = new MessageButton().setCustomId('confirmGif').setLabel('Confirm').setStyle('PRIMARY');
// Next GIF Button
const nextButton = new MessageButton().setCustomId('nextGif').setLabel('Next GIF').setStyle('SECONDARY');
// Cancel Button
const cancelButton = new MessageButton().setCustomId('cancelGif').setLabel('Cancel').setStyle('DANGER');
// Put all the above into an ActionRow to be sent as a component of the reply
const actionRow = new MessageActionRow().addComponents(prevButton, confirmButton, nextButton, cancelButton);
// Get the query // Get the query
const query = interaction.options.getString('query'); const query = interaction.options.getString('query');