10 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 OP
I tried removing the .id at the end of line 8 but that didnt seem to do anytning apart from changing the received data type from undefined to object
<Promise>.id
isn't a thing. You need to handle the Promise returned from fetch()
before you can use any resolved data from it. Why not just pass caseObject.Admin
to your field value instead since your current implementation seems to suggest you just want to put the user ID in the field value? Why bother fetching?I just put the id there to test. I actually wanted to put the user's username in there
so I would have to use the
.then() and .catch()
functions?That's one way, however you can also just wrap your Promise statement in brackets () so you'd then be accessing the resolved value (assuming it does resolve),
(await ...).id
like this?
{ name: "Admin", value: await (interaction.guild.members.fetch(caseObject.Admin)).id }
Your
await
is outside of the brackets, so no that won't workO
You can also just make a variable for this
fetch()
request above if you plan to use any of this member data elsewhereOhh yeahh
Yeah it works like a charm
thx