Jump to content
McKay Development

How to createOffer properly?


Recommended Posts

 

var offer = manager.createOffer("[U:1:46143802]");
offer.addMyItem({"appid": 440, "contextid": 2, "assetid": "1234567890"});
offer.send("Hi there", "KYworVTM", function(err, status) {
    if (err) {
        console.log(err);
    } else {
        console.log("Offer #" + offer.id + " " + status);
    }
});

 

Something like that, where [u:1:46143802] is my SteamID and KYworVTM is my trade token.

Link to comment
Share on other sites

  • 3 weeks later...
var offer = manager.createOffer("[U:1:46143802]");
offer.addMyItem({"appid": 440, "contextid": 2, "assetid": "1234567890"});
offer.send("Hi there", "KYworVTM", function(err, status) {
    if (err) {
        console.log(err);
    } else {
        console.log("Offer #" + offer.id + " " + status);
    }
});

Something like that, where [u:1:46143802] is my SteamID and KYworVTM is my trade token.

 

Hi there McKay. Im not strong in JS as you, so could u help, i just need an example like that, but if i want to recieve items from another person. Thanks you, mate, for all job that you`ve done!

Link to comment
Share on other sites

McKay, thanks for answering, but I just don`t get it, my acc is logged, i`m trying to send offer for my friend, to get his item, but i get an error: some bla-bla + "In order to protect the items in your inventory, you will be unable to trade from this device for 7 days.", but in my steamcommunity i could send it.

My code: 

var offer = manager.createOffer("[U:1:STEAMID]");									
		offer.addTheirItem({"appid": 570, "contextid": 2, "assetid": "247762039"});		
		offer.send("Hi there", "TOKEN", function(err, status) {					
		    if (err) {
		        console.log("There`s an error: " + err);
		    } else {
		        console.log("Offer #" + offer.id + " " + status);
		    }
	});

STEAMID - my friend steamID.

TOKEN - his token from Trade Link.
I begging you, please mate, tell me what am I doing wrong, cause my head gonna be crashed soon.

Edited by MakeCodeNotWar
Link to comment
Share on other sites

  • 5 months later...
var offer = manager.createOffer("[U:1:46143802]");
offer.addMyItem({"appid": 440, "contextid": 2, "assetid": "1234567890"});
offer.send("Hi there", "KYworVTM", function(err, status) {
    if (err) {
        console.log(err);
    } else {
        console.log("Offer #" + offer.id + " " + status);
    }
});

Something like that, where [u:1:46143802] is my SteamID and KYworVTM is my trade token.

 

And if my bot should create trade offer with it's friend, how it will look like?

Link to comment
Share on other sites

That example is old and won't work with v2 (v1 is now unsupported).

 

Code for sending an offer to a friend (without a trade token) with v2 looks like this:

 

 

var offer = manager.createOffer("[U:1:46143802]");
offer.addMyItem({"appid": 440, "contextid": "assetid": 1234567890});
offer.send(function(err, status) {
    if (err) {
        console.log(err);
    } else {
        console.log("Offer #" + offer.id + " " + status);
    }
});
Link to comment
Share on other sites

  • 9 months later...

 

That example is old and won't work with v2 (v1 is now unsupported).

 

Code for sending an offer to a friend (without a trade token) with v2 looks like this:

var offer = manager.createOffer("[U:1:46143802]");
offer.addMyItem({"appid": 440, "contextid": "assetid": 1234567890});
offer.send(function(err, status) {
    if (err) {
        console.log(err);
    } else {
        console.log("Offer #" + offer.id + " " + status);
    }
});

 

Hi there,

 

I use this method, but i keep getting error 26.

My code:

						var offer = manager.createOffer(result[0].url);
						offer.addMyItem({"appid": 730, "contextid": 2,"assetid": result[0].itemid});
						offer.send(function(err, status) {
								if (err) {
										console.log(err);
								} else {
										console.log("Offer #" + offer.id + " " + status);
								}
						});

the result[0].url is a steam trade url and the result[0].itemid is an item id, i have this ran after the bot setted his cookies.

Please help.

 

Bye,

Bart

Link to comment
Share on other sites

How can i confirm the trade?

i have this function:

function checkitems(){
	connection.query('Select tradeurl, itemcode, tradecode, typetrade,tradestatus,sended From bot Where Botchecknummer = 1', function(err, result)
	{
			if (err)
					console.log(err);
			else
					console.log(result);
					console.log(result[0].url);
					if(result != null){
						var offer = manager.createOffer(result[0].tradeurl);

						if(result[0].typetrade == 'withdraw'){
							offer.addMyItem({"appid": 730, "contextid": 2,"assetid": result[0].itemcode });
						}else{
							offer.addTheirItems({"appid": 730, "contextid": 2,"assetid": 9508261450 });
						}
						var id = '0';
						offer.setMessage(result[0].tradecode);
						offer.send(function(err, status) {
								if (err) {
										console.log(err);
								} else {
									console.log("Offer #" + offer.id + " " + status);
								}
						});
						console.log(offer);
						offer.accept(function (err) {
						if (err) {
											console.log("Unable to accept offer "+ offer.id +": " + err.message);
									} else {
											console.log("Offer accepted");
									}
						});
				}

	},100);
}

but it says: Unable to accept offer null: Cannot accept an unsent offer.

If i try it after its send, it says that it cant confirm trade null, trade offer doesnt exist, but the trade offer is waiting for a confirmation

if i do it after console.log("Offer #" + offer.id + " " + status); , it says: Unable to accept offer 2282084226: Offer #2282084226 is not active, so it may not be accepted

 

Bye,

Bart

Edited by Attacler
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...