trumank / scratch-api

An API to interact with the Scratch website
MIT License
94 stars 32 forks source link

Cant send sequential messages #20

Closed encloinc closed 5 years ago

encloinc commented 5 years ago

The api wont let me send sequential messages. Im replying to a comment first and then im posting a new message elswhere (on another profile), however for some reason this isnt working.

joker314 commented 5 years ago

It might be that you are encountering rate limiting (Scratch ignoring too many requests in a shrot amount of time to protect against some types of attacks). Could you share some of your code for us to test, and try adding a shrot delay before sending the second comment.

Is your account labelled as a 'New Scratcher'? The rate limiting for those is much higher.

encloinc commented 5 years ago

oh that might be it yeah im using a new scratcher

joker314 commented 5 years ago

Sounds about right then! Just to check, was there an error passed to the callback function, and if so, what was it?

user.addComment(options_object, console.error)

with options_object probably being something like {parent: "...", replyto: "...", ...}

encloinc commented 5 years ago

No there wasnt any errors, its super weird.

joker314 commented 5 years ago

Ah, yeah, it looks like only issues with the fetching of the data become errors, the status code of the response is not checked. I think there should be an error if the status code is not 200m and that would've probably made this less confusing.

Nonetheless, this does look like a rate-limiting issue, so just try to spread your requests out a little and this issue should be avoided. Alternatively, get a 'Scratcher' status account, but still try not to spam the Scratch servers! :slightly_smiling_face:

encloinc commented 5 years ago

It only sent 2 requests, its just that they were very close to eachother :)