AshIgorash Posted August 6 Report Share Posted August 6 I want to get items that are temporary trade locked. If using manager to get inventory I don't get those items, tried to use community.getUserInventoryContents() but getting undefined inventory and null error. Btw what is difference between manager.getUserInventoryContents and community.getUserInventoryContents? public getInventory(steamID: string):Promise<CEconItem[]>{ return new Promise((resolve, reject)=> { const inventory = this.bot.community.getUserInventoryContents(steamID,730,2,false,'english',(err)=>{console.log(err)}) console.log(inventory) this.bot.tradeManager.getUserInventoryContents(steamID,730,2,false, (err, inventory)=> { if(err){ if(err.message === "This profile is private."){ return reject(new CustomError("This profile is private.",ERR.PrivateProfile)) } else if(err.message.includes("RateLimitExceeded")){ return reject(new CustomError(err.message, ERR.RateLimitExceeded)) } else{ return reject(new CustomError(err.message, ERR.GeneralError)) } } resolve(inventory) }) }) } Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted August 6 Report Share Posted August 6 It's completely expected that you'd get undefined in your inventory variable, since the result is passed to the callback and not returned by the method. Quote Link to comment Share on other sites More sharing options...
AshIgorash Posted August 6 Author Report Share Posted August 6 (edited) Yes, but my callback has only error. /** * Get the contents of a user's inventory context. * @param userID - The user's SteamID as a SteamID object or a string which can parse into one * @param appID - The Steam application ID of the game for which you want an inventory * @param contextID - The ID of the "context" within the game you want to retrieve * @param tradableOnly - true to get only tradable items and currencies * @param [language] - The language of item descriptions to return. Omit for default (which may either be English or your account's chosen language) * @param callback */ getUserInventoryContents( userID: userid, appID: appid, contextID: contextid, tradableOnly: boolean, language: string, callback: Callback, ): any; /** * @param err `null` on success, an `Error` object on failure. */ type Callback = (err: CallbackError) => any; Edited August 6 by AshIgorash Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted August 7 Report Share Posted August 7 The type definition is wrong. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.