diff --git a/.idea/modules.xml b/.idea/modules.xml
index 60ab3a1..1d21c64 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,8 +2,8 @@
-
+
-
\ No newline at end of file
+
diff --git a/.idea/steamcommunity.iml b/.idea/steamcommunity.iml
index 3c366a8..52b9af4 100644
--- a/.idea/steamcommunity.iml
+++ b/.idea/steamcommunity.iml
@@ -5,6 +5,6 @@
-
+
-
\ No newline at end of file
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 18cac0e..33d08e3 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,6 +2,6 @@
-
+
\ No newline at end of file
diff --git a/classes/CSteamSharedfile.js b/classes/CSteamSharedFile.js
similarity index 83%
rename from classes/CSteamSharedfile.js
rename to classes/CSteamSharedFile.js
index 889039a..09b31c4 100644
--- a/classes/CSteamSharedfile.js
+++ b/classes/CSteamSharedFile.js
@@ -1,17 +1,18 @@
const Cheerio = require('cheerio');
const SteamID = require('steamid');
-const Helpers = require('../components/helpers.js');
+
const SteamCommunity = require('../index.js');
-const ESharedfileType = require('../resources/ESharedfileType.js');
+const Helpers = require('../components/helpers.js');
+
+const ESharedFileType = require('../resources/ESharedFileType.js');
/**
* Scrape a sharedfile's DOM to get all available information
- * @param {String} sharedFileId - ID of the sharedfile
+ * @param {string} sharedFileId - ID of the sharedfile
* @param {function} callback - First argument is null/Error, second is object containing all available information
*/
-SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
-
+SteamCommunity.prototype.getSteamSharedFile = function(sharedFileId, callback) {
// Construct object holding all the data we can scrape
let sharedfile = {
id: sharedFileId,
@@ -29,7 +30,6 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
isDownvoted: null
};
-
// Get DOM of sharedfile
this.httpRequestGet(`https://steamcommunity.com/sharedfiles/filedetails/?id=${sharedFileId}`, (err, res, body) => {
try {
@@ -121,15 +121,15 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
let breadcrumb = $(".breadcrumbs > .breadcrumb_separator").next().get(0).children[0].data || "";
if (breadcrumb.includes("Screenshot")) {
- sharedfile.type = ESharedfileType.Screenshot;
+ sharedfile.type = ESharedFileType.Screenshot;
}
if (breadcrumb.includes("Artwork")) {
- sharedfile.type = ESharedfileType.Artwork;
+ sharedfile.type = ESharedFileType.Artwork;
}
if (breadcrumb.includes("Guide")) {
- sharedfile.type = ESharedfileType.Guide;
+ sharedfile.type = ESharedFileType.Guide;
}
@@ -142,7 +142,7 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
}
// Make callback when ID was resolved as otherwise owner will always be null
- callback(null, new CSteamSharedfile(this, sharedfile));
+ callback(null, new CSteamSharedFile(this, sharedfile));
});
} catch (err) {
@@ -152,18 +152,18 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
};
/**
- * Constructor - Creates a new Sharedfile object
+ * Constructor - Creates a new SharedFile object
* @class
* @param {SteamCommunity} community
- * @param {{ id: string, type: ESharedfileType, appID: number, owner: SteamID|null, fileSize: string|null, postDate: number, resolution: string|null, uniqueVisitorsCount: number, favoritesCount: number, upvoteCount: number|null, guideNumRatings: Number|null, isUpvoted: boolean, isDownvoted: boolean }} data
+ * @param {{ id: string, type: ESharedFileType, appID: number, owner: SteamID|null, fileSize: string|null, postDate: number, resolution: string|null, uniqueVisitorsCount: number, favoritesCount: number, upvoteCount: number|null, guideNumRatings: Number|null, isUpvoted: boolean, isDownvoted: boolean }} data
*/
-function CSteamSharedfile(community, data) {
+function CSteamSharedFile(community, data) {
/**
* @type {SteamCommunity}
*/
this._community = community;
- // Clone all the data we recieved
+ // Clone all the data we received
Object.assign(this, data);
}
@@ -172,16 +172,16 @@ function CSteamSharedfile(community, data) {
* @param {String} cid - ID of the comment to delete
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-CSteamSharedfile.prototype.deleteComment = function(cid, callback) {
- this._community.deleteSharedfileComment(this.userID, this.id, cid, callback);
+CSteamSharedFile.prototype.deleteComment = function(cid, callback) {
+ this._community.deleteSharedFileComment(this.userID, this.id, cid, callback);
};
/**
* Favorites this sharedfile
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-CSteamSharedfile.prototype.favorite = function(callback) {
- this._community.favoriteSharedfile(this.id, this.appID, callback);
+CSteamSharedFile.prototype.favorite = function(callback) {
+ this._community.favoriteSharedFile(this.id, this.appID, callback);
};
/**
@@ -189,30 +189,30 @@ CSteamSharedfile.prototype.favorite = function(callback) {
* @param {String} message - Content of the comment to post
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-CSteamSharedfile.prototype.comment = function(message, callback) {
- this._community.postSharedfileComment(this.owner, this.id, message, callback);
+CSteamSharedFile.prototype.comment = function(message, callback) {
+ this._community.postSharedFileComment(this.owner, this.id, message, callback);
};
/**
* Subscribes to this sharedfile's comment section. Note: Checkbox on webpage does not update
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-CSteamSharedfile.prototype.subscribe = function(callback) {
- this._community.subscribeSharedfileComments(this.owner, this.id, callback);
+CSteamSharedFile.prototype.subscribe = function(callback) {
+ this._community.subscribeSharedFileComments(this.owner, this.id, callback);
};
/**
* Unfavorites this sharedfile
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-CSteamSharedfile.prototype.unfavorite = function(callback) {
- this._community.unfavoriteSharedfile(this.id, this.appID, callback);
+CSteamSharedFile.prototype.unfavorite = function(callback) {
+ this._community.unfavoriteSharedFile(this.id, this.appID, callback);
};
/**
* Unsubscribes from this sharedfile's comment section. Note: Checkbox on webpage does not update
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-CSteamSharedfile.prototype.unsubscribe = function(callback) {
- this._community.unsubscribeSharedfileComments(this.owner, this.id, callback);
+CSteamSharedFile.prototype.unsubscribe = function(callback) {
+ this._community.unsubscribeSharedFileComments(this.owner, this.id, callback);
};
diff --git a/components/sharedfiles.js b/components/sharedfiles.js
index c051943..b4fa2c7 100644
--- a/components/sharedfiles.js
+++ b/components/sharedfiles.js
@@ -1,6 +1,7 @@
-var SteamCommunity = require('../index.js');
var SteamID = require('steamid');
+var SteamCommunity = require('../index.js');
+
/**
* Deletes a comment from a sharedfile's comment section
@@ -9,7 +10,7 @@ var SteamID = require('steamid');
* @param {String} cid - ID of the comment to delete
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-SteamCommunity.prototype.deleteSharedfileComment = function(userID, sharedFileId, cid, callback) {
+SteamCommunity.prototype.deleteSharedFileComment = function(userID, sharedFileId, cid, callback) {
if (typeof userID === "string") {
userID = new SteamID(userID);
}
@@ -26,7 +27,7 @@ SteamCommunity.prototype.deleteSharedfileComment = function(userID, sharedFileId
return;
}
- callback(null || err);
+ callback(err);
}, "steamcommunity");
};
@@ -36,7 +37,7 @@ SteamCommunity.prototype.deleteSharedfileComment = function(userID, sharedFileId
* @param {String} appid - ID of the app associated to this sharedfile
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-SteamCommunity.prototype.favoriteSharedfile = function(sharedFileId, appid, callback) {
+SteamCommunity.prototype.favoriteSharedFile = function(sharedFileId, appid, callback) {
this.httpRequestPost({
"uri": "https://steamcommunity.com/sharedfiles/favorite",
"form": {
@@ -49,7 +50,7 @@ SteamCommunity.prototype.favoriteSharedfile = function(sharedFileId, appid, call
return;
}
- callback(null || err);
+ callback(err);
}, "steamcommunity");
};
@@ -60,7 +61,7 @@ SteamCommunity.prototype.favoriteSharedfile = function(sharedFileId, appid, call
* @param {String} message - Content of the comment to post
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-SteamCommunity.prototype.postSharedfileComment = function(userID, sharedFileId, message, callback) {
+SteamCommunity.prototype.postSharedFileComment = function(userID, sharedFileId, message, callback) {
if (typeof userID === "string") {
userID = new SteamID(userID);
}
@@ -77,7 +78,7 @@ SteamCommunity.prototype.postSharedfileComment = function(userID, sharedFileId,
return;
}
- callback(null || err);
+ callback(err);
}, "steamcommunity");
};
@@ -87,7 +88,7 @@ SteamCommunity.prototype.postSharedfileComment = function(userID, sharedFileId,
* @param {String} sharedFileId ID of the sharedfile
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-SteamCommunity.prototype.subscribeSharedfileComments = function(userID, sharedFileId, callback) {
+SteamCommunity.prototype.subscribeSharedFileComments = function(userID, sharedFileId, callback) {
if (typeof userID === "string") {
userID = new SteamID(userID);
}
@@ -103,7 +104,7 @@ SteamCommunity.prototype.subscribeSharedfileComments = function(userID, sharedFi
return;
}
- callback(null || err);
+ callback(err);
}, "steamcommunity");
};
@@ -113,7 +114,7 @@ SteamCommunity.prototype.subscribeSharedfileComments = function(userID, sharedFi
* @param {String} appid - ID of the app associated to this sharedfile
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-SteamCommunity.prototype.unfavoriteSharedfile = function(sharedFileId, appid, callback) {
+SteamCommunity.prototype.unfavoriteSharedFile = function(sharedFileId, appid, callback) {
this.httpRequestPost({
"uri": "https://steamcommunity.com/sharedfiles/unfavorite",
"form": {
@@ -126,7 +127,7 @@ SteamCommunity.prototype.unfavoriteSharedfile = function(sharedFileId, appid, ca
return;
}
- callback(null || err);
+ callback(err);
}, "steamcommunity");
};
@@ -136,7 +137,7 @@ SteamCommunity.prototype.unfavoriteSharedfile = function(sharedFileId, appid, ca
* @param {String} sharedFileId - ID of the sharedfile
* @param {function} callback - Takes only an Error object/null as the first argument
*/
-SteamCommunity.prototype.unsubscribeSharedfileComments = function(userID, sharedFileId, callback) {
+SteamCommunity.prototype.unsubscribeSharedFileComments = function(userID, sharedFileId, callback) {
if (typeof userID === "string") {
userID = new SteamID(userID);
}
@@ -152,6 +153,6 @@ SteamCommunity.prototype.unsubscribeSharedfileComments = function(userID, shared
return;
}
- callback(null || err);
+ callback(err);
}, "steamcommunity");
};
diff --git a/index.js b/index.js
index 6cd2257..e488491 100644
--- a/index.js
+++ b/index.js
@@ -590,7 +590,7 @@ require('./components/help.js');
require('./classes/CMarketItem.js');
require('./classes/CMarketSearchResult.js');
require('./classes/CSteamGroup.js');
-require('./classes/CSteamSharedfile.js');
+require('./classes/CSteamSharedFile.js');
require('./classes/CSteamUser.js');
/**
diff --git a/resources/ESharedfileType.js b/resources/ESharedFileType.js
similarity index 85%
rename from resources/ESharedfileType.js
rename to resources/ESharedFileType.js
index fc528d5..21290c8 100644
--- a/resources/ESharedfileType.js
+++ b/resources/ESharedFileType.js
@@ -1,5 +1,5 @@
/**
- * @enum ESharedfileType
+ * @enum ESharedFileType
*/
module.exports = {
"Screenshot": 0,
@@ -10,4 +10,4 @@ module.exports = {
"0": "Screenshot",
"1": "Artwork",
"2": "Guide"
-};
\ No newline at end of file
+};