Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add postUserStatus(status_text[,appid], callback) #200

Closed
Revadike opened this issue Apr 19, 2018 · 7 comments
Closed

Add postUserStatus(status_text[,appid], callback) #200

Revadike opened this issue Apr 19, 2018 · 7 comments

Comments

@Revadike
Copy link
Contributor

This function will post your user status to https://steamcommunity.com/my/home
It could be done along the lines of this:

function postUserStatus(status_text, appid, callback) {
    var formdata = {
        sessionid: this.getSessionID(),
        status_text: status_text,
        appid: 0
    }
    if (appid) formdata.appid = appid;
    this.httpRequestPost(this.getProfileUrl() + "/ajaxpostuserstatus/", {
            formData: formdata,
            followAllRedirects: true
     }, (error, response, data) => { /* Error & callback handling */ });
}

function deleteUserStatus(postid, callback) {
    var formdata = {
        sessionid: this.getSessionID(),
        postid: postid
    }
    this.httpRequestPost(this.getProfileUrl() + "/ajaxdeleteuserstatus/", {
            formData: formdata,
            followAllRedirects: true
     }, (error, response, data) => { /* Error & callback handling */ });
}

Maybe support callback that includes any error that may have happened and the postid if success for postUserStatus().
Thank you

@Revadike
Copy link
Contributor Author

/ajaxpostuserstatus response example:
{"success":true,"timestart":1524088800,"blotter_html":"/* large HTML string, parse to get postid? */","next_request":"https:\/\/steamcommunity.com\/id\/royalgamer06\/ajaxgetusernews\/?start=1524088800&startoffset=250"}

/ajaxdeleteuserstatus response example:
{"success":1}

@Revadike
Copy link
Contributor Author

I've also discovered that the max length for status_text is 10240 characters.

@Revadike
Copy link
Contributor Author

I've noticed that quite a few times it returns an error for unable to parse JSON. Perhaps check what data says in those cases and return a more meaningful error. Actually, I'll try to help you with this.

@Revadike
Copy link
Contributor Author

It seems body is empty. Perhaps you are not following all redirects?

@Revadike
Copy link
Contributor Author

Nevermind, I checked out the code and it seems you are following all redirects.

@Revadike
Copy link
Contributor Author

Any idea why body is empty sometimes? I didn't have that issue with my personal code.

@DoctorMcKay
Copy link
Owner

Nope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants