TomYoki Posted April 28, 2017 Report Posted April 28, 2017 (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#descriptionsbut 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 April 28, 2017 by TomYoki Quote
SunriseM Posted April 28, 2017 Report Posted April 28, 2017 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 } ) Quote
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.