Jump to content
McKay Development

Recommended Posts

Posted

Hello, i'm newbie in creating bots and i don't know how to make trade sending system properly(It doesn't add items). I provide code below:

var incomeMessage = message;
var splittedMsg = incomeMessage.split(" ");
if(splittedMsg[0] == "!buy") {
	splittedMsg = incomeMessage.slice(5);
	client.chatMessage(steamID, "Sellin' item named " + splittedMsg);
	manager.getUserInventoryContents(steamID, 440, 2, true, (err, inv) => {
		if (err) {
			throw err;
		} else {
			const offer = manager.createOffer(steamID);
			let item = inv.filter(item => item.market_name == splittedMsg);
			let itemsToTrade = item[0];
			offer.addMyItem(itemsToTrade);
			offer.setMessage('You recieved a Refined Metal!');
			offer.send((err, status) => {
				if (err) {
					console.log(err);
				} else {
					console.log('trade sent');
					console.log(status);
				}
			});

		}
	});
}

I send message to bot like !buy Refined Metal and it has to put 1 Refined Metal to trade and then send it to me. But i has error 26. I know it means that i don't have such items in my inventory. So can you help me with that?

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