#yea I understand that but how can I make

1 messages · Page 1 of 1 (latest)

hushed wind
#

t

#

lets talk here

#

can you send the code you currently have

hard basalt
#

Right now I don't have anything but I can send old code.

hushed wind
#

Oh nm

#

Is okay

#

You can generate a new embed each time the button is pressed

hard basalt
#
module.exports = {
    name: 'interactionCreate',
    pavadinimas: 'Matches',
    async execute(bot, interaction) {
        //--
        if (!interaction.isButton()) return;
        const author = interaction.user;

        let Autorius = await Database.findOne({
            guildID: interaction.guild.id,
            userID: author.id
        })

        const button = functions.buttons()

        let person = await Database.aggregate([
            {
                $match: {
                    userID: { $nin: Autorius.tempArray, $ne: author.id },
                    Vardas: { $exists: true }
                }
            },
            {
                $sample: { size: 1 }
            }
        ])

        let User = person[0]

        if (!User)  {
             Database.collection.updateOne(
                { userID: author.id },
                { $unset: { tempArray: "" } }
            ).then(async () => {
                const x = await person
                console.log(x)
            })
            return
        }

        let asmuo = interaction.guild.members.cache.get(User.userID)
        const embed = functions.embed(User, asmuo)


        if (interaction.customId === "paieskosBTN") {
            functions.push(Database, author, User)
            interaction.reply({ embeds: [embed], components: [button], ephemeral: true })
        }

        if (interaction.customId === "matchNEXT") {
            functions.push(Database, author, User)
            interaction.update({ embeds: [embed], components: [button], ephemeral: true })
        }
hushed wind
#

and then update the enbed in the message you already sent

hard basalt
#

I have a list of users. every time button [ NEXT ] is pressed , show other user and don't show previous until list is ended.

#

how to do that? :DD

hushed wind
#

yes

#

Like i said

#

each time the button is pressed you make a new embed

#

and then edit the old message to show the new embed

#

and done

hard basalt
#

embed is embed, how to pick a user?

#

each time that it wont be the same as previous

hushed wind
#

save the index that is being displayed in the message and then read the array for the next one and pick the next one up

#

You could include it in the embed, or you search the list of users with the information from the old embed

#

endless possibilities

hard basalt
#

I tried to push old users, in array but every time button is pressed it generates new array, not pushing.

hushed wind
#

Means somewhere in your code you arent taking the old list but creating a new one

#

somehow

#

you use a database

#

so you can query that

hard basalt
#

but u understand that how long it will be the array in db?

#

if in the server are about 1k+ users?

hushed wind
#

i have 4k members in my server

#

lol

hard basalt
#

so?

hushed wind
#

1k is not much

#

for doing such queries

#

especially if you did the db well

hushed wind
# hard basalt so?

thats what i thought when you said you have 1k members lol, thats tiny numbers for a database

#

ight cya