From b5142ad0cc09f285e35b7940c291c38aa4b3f277 Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Thu, 15 Jun 2017 10:04:37 -0400 Subject: [PATCH] Added language argument to getUserInventoryContents --- .npmrc | 1 + components/users.js | 12 +++++++++--- package.json | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/components/users.js b/components/users.js index 3881946..18b8e86 100644 --- a/components/users.js +++ b/components/users.js @@ -340,15 +340,21 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t * @param {int} appID - The Steam application ID of the game for which you want an inventory * @param {int} contextID - The ID of the "context" within the game you want to retrieve * @param {boolean} tradableOnly - true to get only tradable items and currencies + * @param {string} [language] - The language of item descriptions to return. Omit for default (which may either be English or your account's chosen language) * @param {function} callback */ -SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, contextID, tradableOnly, callback) { +SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, contextID, tradableOnly, language, callback) { var self = this; - if(typeof userID === 'string') { + if (typeof userID === 'string') { userID = new SteamID(userID); } + if (typeof language === 'function') { + callback = language; + language = "english"; + } + var pos = 1; get([], []); @@ -359,7 +365,7 @@ SteamCommunity.prototype.getUserInventoryContents = function(userID, appID, cont "Referer": "https://steamcommunity.com/profiles/" + userID.getSteamID64() + "/inventory" }, "qs": { - "l": "english", // Default language + "l": language, // Default language "count": 5000, // Max items per 'page' "start_assetid": start }, diff --git a/package.json b/package.json index c316338..d42c4a7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,10 @@ "name": "steamcommunity", "version": "3.30.7", "description": "Provides an interface for logging into and interacting with the Steam Community website", - "keywords": ["steam", "steam community"], + "keywords": [ + "steam", + "steam community" + ], "homepage": "https://github.com/DoctorMcKay/node-steamcommunity", "bugs": { "url": "https://github.com/DoctorMcKay/node-steamcommunity/issues"