Editing embeds to preserve original content
I have this set into an embed builder in a listener.ts file:
This is where I handle editing the embed, I want to preserve the original fields added into it, when the application is accepted, so it keeps all the content, but just edits the embed, appending the accepted status above the original content.
Does this mean I have to addFields all the content again when accepting below?
If so, how do I do this? Or how can I achieve the desired functionality?
7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPStructures from the API cannot be edited directly. To do so, you can create a new structure (a builder) using the
.from()
method
The setdescription is handled both places. When the application is first sent in, it sets the embed description to all my fields they should fill out. Then when I hit accept, the second codeblock I sent, it sets the description again, but here it removes the original application content.
So here I would need to use the from() method?
Since it's another file?
This is my listener.ts file:
This is how I build the embed when editing it:
How can I apply the from() method here to retrieve the data from the other file and add them, so the original application data "stays"? I'm a bit lost here 😛
I can't seem to find any documentation on the from() method, how would I apply it in my example here?
I got it all working, but the modal that pops up now, to prompt the interactionuser to submit a reason does not close after hitting submit, instead it waits and gives a "something went wrong, try again" error, but it doesn't fail. The message is sent properly to the applicant's DMs, and the original embed is updated with all the original content of the application + the reason that had been submitted. It just doesn't close the actual modal when submitting a reason, and gives that error, but it is 100% functional and works as intended otherwise.
You have to resolve the interaction.
I would suggest that you send an ephemeral reply or you can just deferUpdate
How would i Apply those solutions in the code?
I have an application that is as, handled by another typescript. Then my code when I hit the deny with reason button opens a modal, prompting for the reason. When I hit submit in that it doesn’t close, and I get the error, but the meaaage with the rejection and added reason is successful, the application embed is also changed to rejected and the content preserved while noting the reason at the end. But the reason modal doesn’t actually close and the error pops up when hitting submit. What line should I add to resolve/properly close the reason modal when I have hit submit.
If you resolve the interaction, the modal will close.
I've grown blind on this block of code, where do I need to implement the resolve to have it properly close the reason input modal after hitting submit?
Thank you so, so much!