Add sharedfile subscribing support

This commit is contained in:
3urobeat 2023-05-12 23:16:01 +02:00
parent 18011b3fac
commit d807f10653
No known key found for this signature in database
GPG Key ID: 6842D80775A4E952

View File

@ -59,6 +59,58 @@ SteamCommunity.prototype.postSharedfileComment = function(userID, sid, message,
}, "steamcommunity");
};
/**
* Subscribes to a sharedfile's comment section. Note: Checkbox on webpage does not update
* @param {SteamID | String} userID ID of the user associated to this sharedfile
* @param {String} sid ID of the sharedfileof
* @param {function} callback - Takes only an Error object/null as the first argument
*/
Bot.prototype.subscribeSharedfileComments = function(userID, sid, callback) {
if (typeof userID === "string") {
userID = new SteamID(userID);
}
this.httpRequestPost({
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/subscribe/${userID.toString()}/${sid}/`,
"form": {
"count": 10,
"sessionid": this.getSessionID()
}
}, function(err, response, body) { // eslint-disable-line
if (!callback) {
return;
}
callback(null || err);
}, "steamcommunity");
};
/**
* Unsubscribes from a sharedfile's comment section. Note: Checkbox on webpage does not update
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
* @param {String} sid - ID of the sharedfileof
* @param {function} callback - Takes only an Error object/null as the first argument
*/
Bot.prototype.unsubscribeSharedfileComments = function(userID, sid, callback) {
if (typeof userID === "string") {
userID = new SteamID(userID);
}
this.httpRequestPost({
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/unsubscribe/${userID.toString()}/${sid}/`,
"form": {
"count": 10,
"sessionid": this.getSessionID()
}
}, function(err, response, body) { // eslint-disable-line
if (!callback) {
return;
}
callback(null || err);
}, "steamcommunity");
};
/**
* Downvotes a sharedfile
* @param {String} sid - ID of the sharedfile