Jump to content
McKay Development

Can't get inventory using community.getUserInventoryContents()


Recommended Posts

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)
             
            })
        })
    }
Link to comment
Share on other sites

Posted (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 by AshIgorash
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...