Jump to content


Photo

Some small questions

node.js node-steam-tradeoffer-manager

  • Please log in to reply
3 replies to this topic

#1 PonyExpress

PonyExpress

    Member

  • Member
  • PipPip
  • 22 posts

Posted 27 March 2019 - 05:30 PM

I have several questions that I have been looking for an answer for a long time.

Some of my questions are more for a node js, sorry for that. And thanks in advance for your help!
 
1:
If I need to decline/delete incoming offers that were not accepted in 10 minutes, would this be the right?
Maybe there are any cases, why can it be a bad option?
manager.on("newOffer", (OFFER) => {
    setTimeout(function() {
        OFFER.decline();
    }, $MINUTE * 10);

2:

I have to save completed trades. If not - sometimes some of them work 2-3 times. Why?
// "pollInterval": "10000",
// "dataDirectory": "./pool_data",
// "savePollData": true

var completedTrades = [];
manager.on("sentOfferChanged", (OFFER) => {
    if (completedTrades.indexOf(OFFER.id) >= 0) {
        console.log("aborted");
        return;
    }
    if (OFFER.state == 3) {
        completedTrades.push(OFFER.id);
        console.log("completed");

//Log: completed aborted aborted
3:
In some trading offers I add data:
trade.data("somedataname", myvar.toString());

After i check it this way (Is this correct or can it be different?):

manager.on("sentOfferChanged", (OFFER) => {
    if (!!OFFER.data("somedataname")) {
        console.log("trade with somedataname");

4:

If I want to make a counter offer to a user (not on the list of friends) - will it work as I am create a new offer?
manager.on("newOffer", (OFFER) => {
    let trade = OFFER.counter();
    trade.getUserDetails((ERR, BotDetails, UserDetails) => {
      OFFER.itemsToGive = [];
      OFFER.itemsToReceive = [];
      //... add items
        trade.send((ERR) => {

5:

How can I use more than 1 appid / txid?

manager.getUserInventoryContents(SENDER, 753, 6, true, (ERR, USERINVENTORY) => {

Here I will get only Steam (753-6);

What should I do to add for example TF items (440-2)

 



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,042 posts

Posted 27 March 2019 - 09:09 PM

  1. That might work, but I wouldn't recommend using it as you'd be calling decline on offers that might have already been accepted. I would use offerList and check the creation time of the offers.
  2. I don't understand the question. sentOfferChanged is being emitted multiple times for the same offer with state 3?
  3. That looks correct.
  4. Actually, no. That's a bug. As a workaround you can use getUserDetails on the original offer that you're countering. Also, you should never reassign itemsToGive or itemsToReceive. Use the add(My/Their)Item(s) methods instead.
  5. You can't. You need to call it once per appid/contextid.

  • PonyExpress likes this

#3 PonyExpress

PonyExpress

    Member

  • Member
  • PipPip
  • 22 posts

Posted 27 March 2019 - 10:59 PM

Thanks for the answer.

 

I use:
OFFER.itemsToGive = [];
OFFER.itemsToReceive = [];
To remove all items added by the sender.

 

 

 

sentOfferChanged is being emitted multiple times for the same offer with state 3?

Yes. Tomorrow I will check and provide more details when this happens.



#4 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,042 posts

Posted 28 March 2019 - 12:20 AM

You should not do that. Use removeMyItem and removeTheirItem instead.







Also tagged with one or more of these keywords: node.js, node-steam-tradeoffer-manager

2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users