Image 1

This is the main command file for the button and this is where I am trying to export the variables from.
 avatar
unknown
javascript
3 years ago
2.4 kB
8
Indexable
// import all the required modules
const { EmbedBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextChannel, ButtonBuilder, Embed, ClientVoiceManager } = require('discord.js');
const { sequelize, log_settings } = require('../../../../../bot');
const Sequelize = require('sequelize');
module.exports = {
    // The options and information for the current command
    name: 'guildlist',
    description: 'Shows all guilds that the bot is in, you can also you search terms to define your search.',
    options: [
        {
            name: `search_term`,
            description: `Enter an id or search term to filter results`,
            type: 3,
            required: true
        }
    ],
    run: async (client, interaction, container) => {
        await interaction.deferReply();
        try {
            const search_term = interaction.options.getString('search_term')
            const search_type = interaction.options.getString('search_type')
            let embeds = []
            let pages = {}

            for (let a = 0; a < 4; ++a) {
                embeds.push(new EmbedBuilder().setDescription(`Page ${a + 1}`))
            }
            const getRow = (userid) => {
                const row = new ActionRowBuilder()
                row.addComponents(
                    new ButtonBuilder()
                        .setCustomId('prev_page')
                        .setLabel('Prev')
                        .setStyle(2)
                        .setDisabled(pages[userid] === 0),
                    new ButtonBuilder()
                    .setCustomId('next_page')
                        .setLabel('Next')
                        .setStyle(2)
                    .setDisabled(pages[userid] === embeds.length - 1)
                )
                return row;
            }
            const userid = interaction.user.id
            pages[userid] = pages[userid] || 0
            const embed = embeds[pages[userid]]
            interaction.editReply({ embeds: [embed], components: [getRow(userid)] })
            exports.getRow = getRow;
            exports.userid = userid;
            exports.embeds = embeds;
            exports.pages = pages;
        }
        catch (err) {
            console.log(err)
            interaction.editReply('An Error Ocurred!')
        }
    },
};
Editor is loading...