Simplifying the API request process
This code works well, but can we streamline it further? Currently, we specify the channelId separately from the request body. Is there a way to combine all required parameters into one object, like this?
8 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$ npm list discord.js @discordjs/core @discordjs/rest && node -v
[email protected] C:\Program Files\Git\projects\botstudio
├─┬ @discordjs/[email protected]
│ ├── @discordjs/[email protected] deduped
│ └─┬ @discordjs/[email protected]
│ └── @discordjs/[email protected] deduped
├── @discordjs/[email protected]
└─┬ [email protected]
└── @discordjs/[email protected] deduped
v22.1.0
Or maybe we can use another method to do this?
Or just how to get the API method required for a route?
i'm not experienced at all with the rest api
but the most i see that you could do is
i don't see how you could do that withing the method
Yes. But that's not the problem. I want to send API requests like this:
Currently I have to send them like this:
The difference is simple; in the first one, we can include all parameters in a single object.
Thanks BTW
docs don't take in another param
maybe
another function?
Yes sure
let me re-clarify
build your own function that already has rest & api defined
wait
hmm
I think this is too complicated; I'll try to find another way. Thanks BTW