Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
Cant update message in Discord.js

I'm building a leadership team based on experience. After the ~leaders command, the bot sends a message with a list of users. I made a pagination and buttons to switch between pages. When I successfully get new users, I put them in "insert.fields", and then I want to update the interaction. But I get an error message. embeds and components are valid, it seems to me, but I still get an error message:

DiscordAPIError: Unknown interaction at RequestHandler.execute (C:\Users\Пользователь\Desktop\KurBot\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RequestHandler.push (C:\Users\Пользователь\Desktop\KurBot\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async ButtonInteraction.update (C:\Users\Пользователь\Desktop\KurBot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:214:5) at async updateLidersMessage (file:///C:/Users/%D0%9F%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8C/Desktop/KurBot/commands/users/showLiders.js:129:5)

const updateLidersMessage =async (interaction, page, button) =>{
const buttonType = button.type;
const embeds = interaction.message.embeds[0];
const components = interaction.message.components;
const amountUsers = await getUsersCount()

if(buttonType == "left") {
    page--
    changePage(interaction.message.id, "decrement")
}
else if(buttonType == "right") {
    page++
    changePage(interaction.message.id, "increment")
}
else {
    deleteLidersMessage(interaction)
    return
}
embeds.fields = await getLidersPage(page);

if(page-1 == 1){
    components[0].components[0].setDisabled(true)
    components[0].components[1].setDisabled(false)
}
if(embeds.fields.length < 10){
    components[0].components[0].setDisabled(false)
    components[0].components[1].setDisabled(true)
}
else{
    components[0].components[0].setDisabled(false)
    components[0].components[1].setDisabled(false)
}
console.log(embeds);
console.log(components);
embeds.setAuthor({name:`Страница ${page} из ${Math.ceil(amountUsers/10)} - Всего участников ${amountUsers}`})
await interaction.update({ embeds:[embeds], components:[components[0]]})

}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!