#How to edit embed inside of a thread ?

9 messages · Page 1 of 1 (latest)

cloud kindle
#

Trying to get cache of the thread channel, it's ok but get cache from a message in this thread channel returns undefined

undefined
\src\services\report\report.js:43
    threadEmbed.fields.push({name: "Modérateur assigné", value: `<@${interaction.user.id}>`});
                ^

TypeError: Cannot read properties of undefined (reading 'fields')
    at reportAssignButton (\src\services\report\report.js:43:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
knotty blaze
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

cloud kindle
#

For more infos :

  • The bot is admin and has created this thread (so the bot is in this thread)
  • It is a private thread
tepid vessel
cloud kindle
#

the thread is not undefined because it returns me a ThreadChannel and report is an object from my database which contains a lot of information about user report
report object looks like this:

#

the second embed "output" working well with editing his embed but not the thread channel one

#

for stack trace :

[...]   // console.log(thread) (ThreadChannel object blabla)...
 archiveTimestamp: 1667694299962,
  _createdTimestamp: 1667694299962,
  ownerId: '788427274599792711',
  lastMessageId: '1038614058536009811',
  lastPinTimestamp: null,
  rateLimitPerUser: 0,
  messageCount: 2,
  memberCount: 2,
  totalMessageSent: 3,
  appliedTags: []
}
1038609918766358538   // console.log(Thread Message ID from DB)
\src\services\report\report.js:42
    const threadEmbed = await thread.messages.cache.get(report.embeds.thread.threadMessageId).embeds[0]; // Thread Message : undefined so error
                                                                                             ^

TypeError: Cannot read properties of undefined (reading 'embeds')
    at reportAssignButton (\src\services\report\report.js:42:94)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nodemon] app crashed - waiting for file changes before starting...
#

but this message exists

leaden gazelle