Skip to content

Add getBlockedListFunction#266

Closed
Preport wants to merge 3 commits intoDoctorMcKay:masterfrom
Preport:master
Closed

Add getBlockedListFunction#266
Preport wants to merge 3 commits intoDoctorMcKay:masterfrom
Preport:master

Conversation

@Preport
Copy link

@Preport Preport commented Apr 20, 2021

Adds the function requested in issue #255

Co-authored-by: Mr-VIT <vit@v1t.su>
Co-authored-by: Revadike <revadike@outlook.com>
Comment on lines +86 to +106
SteamCommunity.prototype.getBlockedList = function (callback) {
this.httpRequestGet("https://steamcommunity.com/my/friends/blocked?ajax=1", function (err, res, body) {
if (res.req.path.substring(0,6) == "/login") {
callback(new Error("Not Logged In"));
return;
}
if (!body) {
callback(new Error("Malformed response"));
return;
}

var blocked = [],
regex=/\bdata-steamid="(\d+)"/g,
matches;
while (matches = regex.exec(body)) {
blocked.push( new SteamID(matches[1]) );
}
callback(null, blocked);
}, "steamcommunity")
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not the correct place for this function, because all other functions are meant for a single user and take userID as argument.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it fits best in index.js

@@ -83,6 +83,27 @@ SteamCommunity.prototype.removeFriend = function(userID, callback) {
}, "steamcommunity");
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing jsdoc

@Revadike Revadike mentioned this pull request Jun 4, 2021
@Revadike
Copy link
Contributor

Revadike commented Jun 4, 2021

I'm sorry, while I was making a get friends list function I discovered that this endpoint also includes your blocked list, thus making this PR not needed.

@DoctorMcKay
Copy link
Owner

Closing in favor of #267.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants