Jump to content
McKay Development

Function that sends offer - basic -


chnel

Recommended Posts

Hi there,

i've been doing some tries as hobby and i wanted to share with you. I believe it will be usefull.

 

before read or copying the code just consider some valuable;

♦offer is a call from TradeOfferManager, so you will need to replace atleast tags.

var manager = new TradeOfferManager({"steam":client,"domain":"google.com","language":"en"});

♦client is a call of SteamUser.

var client = new SteamUser();
function sndTrade(mnItm,cItm,trdLink)
{
  manager.setCookies(cookies, function(err)
	{
    if (err){console.log(err);process.exit(1);return;}
    var offer = manager.createOffer(trdLink);
    offer.addMyItem({"assetid":mnItm,"appid":730,"contextid":2});
    offer.addTheirItem({"assetid":cItm,"appid":730,"contextid":2});
    offer.send(function(err,status)
    {
      if (err) {console.log(err);return;}
      if (status == "pending"){console.log("offer #${offer.id} sent, but reqires confirmation.");}
    });
    community.setCookies(cookies);
  });
}

How to use :

 

explanation of valuables;

mnItm : is your item's assetid that you want to add to trade.

cItm    : is the assetid of you want to get.

trdLink: is the trade link of the person you want to trade.

 

Example using :

sndTrade("0000000","1111111",https://steamcommunity.com/tradeoffer/new/?partner=0000000&token=1111111)

To easily get assetid of the other user's item you can use https://dev.doctormckay.com/topic/644-function-that-returns-the-assetid-of-specific-item-basic/ as well.

Note : that function have been written for CSGO if you want to use this for other apps just edit the appid with yours or you could add a valuable to function and send it while calling the function.

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