sentanos / roblox-js

!!!THIS PROJECT IS NO LONGER MAINTAINED!!! Execute ROBLOX website actions in node.js
MIT License
45 stars 45 forks source link

Get status not working? #102

Closed ghost closed 6 years ago

ghost commented 6 years ago

So I took the code from some other thread that was answered..

And it comes up with this error:

await is only valid in async function

const status = await rbx.getStatus(await rbx.getIdFromUsername(username));

suufi commented 6 years ago

Before copy & pasting anything you see on the internet, be sure you understand what it does first. Read this article to understand more about async/await: https://anidiots.guide/other-guides/async-await.

ghost commented 6 years ago

Still confused..

ghost commented 6 years ago

is rbx.getStatus not a async function?

suufi commented 6 years ago

Yes and that's why you must use it inside an async function while awaiting it.

On Sat, Jun 9, 2018 at 14:57 OutlookG notifications@github.com wrote:

is rbx.getStatus not a async function?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/sentanos/roblox-js/issues/102#issuecomment-395991143, or mute the thread https://github.com/notifications/unsubscribe-auth/AMKxJK_ZOO6ruQvKj-AQouY-5vCLOOrNks5t7BqOgaJpZM4UfIgK .

sentanos commented 6 years ago

The issue is not rbx.getStatus, it has nothing to do with whether rbx.getStatus is an async function. The function using async/await has to be async.

On Jun 9, 2018, at 12:15, suufi notifications@github.com wrote:

Yes and that's why you must use it inside an async function while awaiting it.

On Sat, Jun 9, 2018 at 14:57 OutlookG notifications@github.com wrote:

is rbx.getStatus not a async function?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/sentanos/roblox-js/issues/102#issuecomment-395991143, or mute the thread https://github.com/notifications/unsubscribe-auth/AMKxJK_ZOO6ruQvKj-AQouY-5vCLOOrNks5t7BqOgaJpZM4UfIgK .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ghost commented 6 years ago

so I have to put it in a async function.. ohhhh ok.