seishun / node-steam-trade

Node.js wrapper around Steam trading
162 stars 36 forks source link

Question about multiple messages in console #23

Closed CoericK closed 11 years ago

CoericK commented 11 years ago

Hey there, i am new with this stuff of bots and i hope someone help me. I can run the bot and all ok, i configurated the bot to just accept the trades from 1 admin, so its working ok but i just noticed something in the console. First time:

  1. Admin proppose the trade to the bot.
  2. Bot accept. Console prints: Trade proposed. Trading ADMINNICK And then i cancel the trade just for test. console prints: trade cancelled.

All fine. Now

Second time:

  1. Admin proppose the trade to the bot.
  2. Bot accept. console prints: tradeProposed trading ADMINNICK trading ADMINNICK And then i cancel the trade again: console prints: trade cancelled trade cancelled.

If i do this a third time i will get: tradeProposed trading ADMINNICK trading ADMINNICK trading ADMINNICK Then trade cancelled trade cancelled trade cancelled

Seems like by each trade is being save somewhere and when a new trade is proposed its calls the sessionStart event, also i tested this when i accept the trade and secont trade propose and the bot accept it prints on console: tradeProposed trading ADMINNICK trading ADMINNICK readying readying confirming confirming trade complete trade complete.

Its not the big deal but is that ok? or its just me?

seishun commented 11 years ago

Show your code.You're probably adding event listeners in the wrong place.

CoericK commented 11 years ago

Nevermind was my mistake. yes i did i was setting the listener of sessionStart inside of the listener of tradeProposed.

I have another question.

i didt this:

var bot = {}; bot.steam = new Steam.SteamClient(); bot.steamTrade = new SteamTrade(); bot.steam.on('sessionStart', function(otherClient) { inventory = []; scrap = []; weapons = 0; addedScrap = []; client = otherClient; console.log('trading ' + bot.steam.users[client].playerName); bot.steamTrade.open(otherClient); });

bot.steamTrade.on('ready', function() {
    console.log('readying');
    bot.steamTrade.ready(function() {
    console.log('confirming');
    bot.steamTrade.confirm();
    });
});

My question is, this is setting to accept and confirm all the trades comming right? What if the bot sent a trade to a user and, the bot just want to accept if the offer is valid ?

seishun commented 11 years ago

Sorry, but the issue tracker isn't a good place to ask how to write code. Maybe try asking in #opensteamworks on irc.gamesurge.net, there might be node-steam-trade users there willing to help.