Closed ghost closed 3 years ago
You need to use the Promise correctly. One way to do it is:
r6api
.getId(platform, username)
.then(el => el[0].userId)
.then(console.log)
If you've never worked with asynchronous code yet, it's better if you watch/read a couple of guides, since it's a broad subject and it would be difficult to teach you everything in this issue.
I've done that too and it gave me the same result (of course the code was ran on runkit, so it's simplified)
ok, i am using this package with discord.js. the id shows properly only in console in asynchronous function. But it does not show properly on discord message. Maybe i'll review my full code again until i find why.
Thank you for your help anyway.
this code outputs
but by
this code will show me my userid (of course only in runkit, i get "await is only valid in async function" on my console)
Can someone help me how to make my code show my userid?