Jump to content
McKay Development

Recommended Posts

Posted (edited)

So I've been making my bot and I came up with that I need to check item description for item within trade offer, 

I found this https://github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem#descriptions

but item.descriptions & item.description doesn't seem to work.

This is my part of the code:

    offer.itemsToReceive.forEach(function(item) {

(this is the 388th line) if (item.appid == "my app ID" &&  item.type.match("My match")) {
        if(item.descriptions.match("my description match")){
        return
} 

This is the output: 

.js:388
                if(item.descriptions.match("my description match we were talking about")){
                                     ^

TypeError: item.descriptions.match is not a function
Edited by TomYoki
Posted

Because match is used in Strings and items.descriptions is an array.

 

You can use find().

function matchDescription(description) { 
    return description === 'my description match';
}

(this is the 388th line) if (item.appid == "my app ID" && item.type.match("My match")) {
  if(item.descriptions.find(matchDescription)){
    return
  }
)

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...