#yea I understand that but how can I make
1 messages · Page 1 of 1 (latest)
Right now I don't have anything but I can send old code.
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 })
}
and then update the enbed in the message you already sent
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
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
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
I tried to push old users, in array but every time button is pressed it generates new array, not pushing.
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
but u understand that how long it will be the array in db?
if in the server are about 1k+ users?
so?
thats what i thought when you said you have 1k members lol, thats tiny numbers for a database
ight cya