示例#1
0
client.on('loggedOn', function() {
    logger.info('Logged on to Steam');
    // Optional: Rename the bot on login.
    client.setPersonaName("CrateDumpBot"); 
    // Make sure we're not displaying as online until we're ready
    client.setPersonaState(steam.EPersonaState.Offline); 
});
示例#2
0
bot.on('loggedOn', function() {
	var mainChat = '';
	console.log('Logged in!')
	bot.setPersonaName('Dealer')
	bot.setPersonaState(Steam.EPersonaState.Online); // to display your bot's status as "Online"
	bot.joinChat(mainChat);
})
示例#3
0
      function getSteamGuardCode(cb) {
        if (config.steamGuard) {
          return cb();
        }

        var steam = new Steam.SteamClient();
        steam.logOn({
          accountName: config.steamUsername,
          password: config.steamPassword
        });

        steam.once('error', function (e) {
          if (e.cause != 'logonFail') {
            throw e;
          }
          if (e.eresult == Steam.EResult.InvalidPassword) {
            delete config.steamUsername;
            delete config.steamPassword;
            saveConfig();
            throw new Error('Your username and/or password is invalid. Try again.');
          } else if (e.eresult == Steam.EResult.AlreadyLoggedInElsewhere) {
            throw new Error('This account is already logged in elsewhere.');
          } else if (e.eresult == Steam.EResult.AccountLogonDenied) {
            console.log('Your Steam Guard code should have been emailed to you.');
            console.log('Enter Steam Guard Code:');
            stdin(function (data) {
              authCode = data;
              cb();
            }, 'You must provide Steam Guard Code. Wait for email or check your Spam folder.');
          } else {
            throw e;
          }
        });
      },
示例#4
0
bot.on('loggedOn', function() {
  console.log('Logged in!');
  this.fillTauntArray();
  bot.setPersonaState(Steam.EPersonaState.Online); // to display your bot's status as "Online"
  bot.setPersonaName(config.name); // to change its nickname
  bot.joinChat(config.defaultChannel); // the group's SteamID as a string
});
示例#5
0
fs.exists('accountData.txt', function (exists) {
    if(exists) {
        var accountData = fs.readFileSync('accountData.txt').toString().split('\n');
        console.log('Loaded account details from file');
        //console.log('User: '******' Pass: '******'sentry',function(sentryHash) {
            console.log('sentry file does not exist');
            fs.writeFile('sentryfile',sentryHash);
        });
        
        bot.on('loggedOn', function () {
            console.log('Logged in as ' + bot.steamID);
        });
    }
    else{
        console.log('No account details file!');
    }
});
示例#6
0
 findGameToIdle(function (gameToIdle) {
     //util.log('Finished poll');
     if (gameToIdle != gameToIdle_index) {
         if (gameToIdle == 0) {
             if (numTimesNoGame > 12) {
                 bot.gamesPlayed([gameToIdle]);
                 util.log('No game to idle for ' + ((config.badge_check_idle * numTimesNoGame) / 60000) + 'mins');
             }
             else {
                 util.log('No game to idle.');
             }
             //util.log('Getting a new cookie and waiting until next check. Attempt: ' + numTimesNoGame);
             numTimesNoGame++;
             getCookie(function () {
                 util.log('Cookie set.');
             });
         }
         else {
             gameToIdle_index = gameToIdle;
             util.log('Changing idle game to: ' + gameToIdle);
             bot.gamesPlayed([gameToIdle]);
             numTimesNoGame = 0;
         }
     }
     else if (numTimesNoGame > 12) {
         util.log('Changing idle game to: ' + gameToIdle);
         bot.gamesPlayed([gameToIdle]);
         numTimesNoGame = 0;
     }
     else {
         util.log('Still idling: ' + gameToIdle);
     }
 });
示例#7
0
bot.on('loggedOn', function() {
	var mainChat = '';
//  var mainChat = '';
	console.log('Logged in!');
	bot.setPersonaName('Dealer');
	bot.setPersonaState(Steam.EPersonaState.Online); // to display your bot's status as "Online"
	joinChat(mainChat,'','');//'' is to keep inviterID and name from screwing everything up
});
示例#8
0
DotaBot.prototype.connect = function(two_factor_code) {
  steamClient.connect();
  steamClient.on('connected', function() {
    this.onConnect(two_factor_code);
  }.bind(this));
  steamClient.on('logOnResponse', this.onLogon);
  steamClient.on('error', this.onError);
}
示例#9
0
client.on('tradeProposed', function(tradeID, steamID) {
    if (inTrade) {
        client.respondToTrade(tradeID, false); // Decline
        client.sendMessage(steamID, 'I\'m currently trading with someone else.');
    } else {
        client.respondToTrade(tradeID, true); // Accept
        logger.info('[' + steamID + '] Accepted trade request');
    }
});
示例#10
0
					steamTrade.on('end', function(status, getItems) {
						winston.info("Trade ended with status " + status);
						if (!paused) {
							bot.setPersonaState(steam.EPersonaState.LookingToTrade);
						}
						if (status == 'complete') {
							bot.sendMessage(steamId, tradeCompleteMessage);
						}
					});
示例#11
0
 bot.on('loggedOn', function() {
     console.log('[STEAM] Connecté.');
     bot.setPersonaState(Steam.EPersonaState.Online);
     //Emule les jeux suivants.
     //440=tf2
     //550=l4d2 
     //730=csgo
     //570=dota2
     // 271590=gta v
     //290080=life is feodal 
     bot.gamesPlayed([271590, 550, 730, 570, 290080]);
 });
示例#12
0
function typeMessage(steamID, message) {
    if(emutyping_enabled) {
        var delay = Math.min(message.length * (1000 / emutyping_speed), emutyping_maxdelay * 1000);

        bot.sendMessage(steamID, "", Steam.EChatEntryType.Typing);
        setTimeout((function () {
            bot.sendMessage(steamID, message, Steam.EChatEntryType.ChatMsg);
        }), delay);

    } else {
        bot.sendMessage(steamID, message, Steam.EChatEntryType.ChatMsg);
    }
}
示例#13
0
bot.on('chatMsg', function(source, message, type, chatter) {
  // respond to chatroom messages only
  console.log('Received message: ' + message);
  if (message == '!info') {
      bot.send_message(source, bot.info);
  }
  if ( _.contains(['!taunt', '!v55'], message) ) {
      bot.taunt(source, chatter);
  }
  if ( _.contains(['!sg', '!startgame', '!create', '!start'], message) ) {
      bot.start_game(source, chatter);
  }
  if ( _.contains(['!list', '!listpool', '!lp', '!lpool'], message) ) {
      bot.list_pool(source, chatter);
  }
  if ( _.contains(['!join', '!j', '!sign', '!s'], message) ) {
      bot.join_game(source, chatter);
  }
  if ( _.contains(['!out', '!o', '!leave', '!l'], message) ) {
      bot.leave_game(source, chatter);
  }
/*
  if (_.contains(['!volunteer', '!v', '!captain', '!cap'], message)) {
    bot.volunteer(source, chatter);
  }
*/
  if (message == '!end') {
      bot.end_game(source, chatter);
  }
  if (message == '!nq') {
      bot.notQueued(source, chatter);
  }
});
示例#14
0
bot.readyPlayer = function(chatter, match) {
  if (this.games.length > 0) {
    if ((typeof match.players[chatter] != "undefined") && (match.ready === 0)) {
	  match.players[chatter].ready = 1;
	  bot.send_message(chatter, 'Thanks for readying up. Check back in with the channel for the draft.');
	  if (_.size(_.where(match.players, {ready: 1})) == 10) {
	    bot.matchmaking(match);
	  }
	} else {
	  bot.send_message(chatter, 'You aren\'t in a game, or the queue isn\'t full yet.');
	}
  } else {
    bot.send_message(chatter, 'There aren\'t any games to ready up for. Go start one!');
  }
};
示例#15
0
trade.on('end', function(result, getItems) {
    inTrade = false; // Allow new trades
    myBackpack = null; // Prevent stale backpack information by resetting
    // Change from Busy back to Looking To Trade
    client.setPersonaState(steam.EPersonaState.LookingToTrade);

    if (result == 'timeout') {
        logger.warn('Trade timed out');
        client.sendMessage(trade.tradePartnerSteamID, 'The trade timed out. This usually means Steam is having problems. Please try again later.');
    } else if (result == 'complete') {
        logger.info('Trade complete');
    } else { 
        logger.debug('Trade ended: '+result);
    }
});
示例#16
0
eventHandler.on = function(n,c){
  var from,name,callback;
  if( ! n.from || ! n.name || ! n.callback ){
    L.debug("WARNING! Registering events anonymously is highly discouraged. Please use an EventObject instead.");
    from="anonymous_" + new Date().getTime();
    name=n;
    callback=c || function(){};
  }
  else {
    if( ! n.from || ! n.name || ! n.callback ){
      L.debug("WARNING! A plugin is trying to inject an invalid event. Discarding.");
      return false;
    }
    from=n.from;
    name=n.name;
    callback=n.callback;
  }

  if( ! events[from] ) events[from]=callback;
  events[from][name]=callback;
  try {
    bot.on(name, callback);
  }
  catch(e){
    L.warn("A plugin (" + from + ") unsuccessfully tried to register an event (" + e + ")");
    L.debug(e.stack);
  }
}
示例#17
0
function webLogin(callback) {
    logger.verbose("Connecting to Steam Web...");
    clearTimeout(getcounttimer);
    clearTimeout(heartbeattimer);
    client.webLogOn(function (data) {
        offers.setup({
            "sessionID": sessionID,
            "webCookie": data
        }, function() {
            offers.getAPIKey(function (err) {
                if (err && err.message === 'Access Denied: Family View Enabled') {
                    if(accountinfo.pin) {
                        offers.getFamilyCookie({"pin": accountinfo.pin}, callback);
                    } else {
                        getFamilyPIN(callback);
                    }
                } else {
                    if(accountinfo.pin) {
                        offers.getFamilyCookie({"pin": accountinfo.pin}, function() {
                            offerReady(callback);
                        });
                    } else {
                        offerReady(callback);
                    }
                }
            });
        });
    });
}
示例#18
0
bot.on('message', function(source, message, type, chatter) {
    if(message == 'ping') {
        console.log("Recieved 'ping', sending 'pong'.");
        bot.sendMessage(source, 'pong', Steam.EChatEntryType.ChatMsg);
    }
    else if(message.length > 0) {
        var log_line     = getDateTime() + ' - ' + message + '\n'; // the line written to file
        var console_line = bot.users[source].playerName + ": " + message; // the line written to console

        console.log(console_line);

        var chat_dir = path.join(__dirname, "chat");

        ensurePresent(chat_dir, function(fileerr) {
            if(fileerr) {
                console.log(fileerr);
            } else {
                fs.appendFile(path.join(chat_dir, source), log_line, function(err) {
                    if(err) {
                        console.log(err);
                    }
                });
            }
        });
    }
});
示例#19
0
 irc.on('message' + details.channel, function(from, message) {
   steam.sendMessage(details.chatroom, '<' + from + '> ' + message);
   
   var parts = message.match(/(\S+)\s+(.*\S)/);
   
   var triggers = {
     '.k': 'kick',
     '.kb': 'ban',
     '.unban': 'unban'
   };
   
   if (parts && parts[1] in triggers) {      
     irc.whois(from, function(info) {
       if (info.channels.indexOf('@' + details.channel) == -1)
         return; // not OP, go away
       
       Object.keys(steam.users).filter(function(steamID) {
         return steam.users[steamID].playerName == parts[2];
       }).forEach(function(steamID) {
         steam[triggers[parts[1]]](details.chatroom, steamID);
       });
     });
   } else if (message.trim() == '!lu' || message.trim() == '~lu') {
     response = "Current Users: " + Object.keys(steam.chatRooms[details.chatroom]).map(function(steamid){return steam.users[steamid].playerName;}).join(', ');
     irc.say(details.channel, response)
   }
 });
示例#20
0
文件: v3.js 项目: bendl/vo-node-steam
bot.on('friend', function (steamid, friendtype) {

    offers.loadMyInventory(440, 2, function (success, inv) {
        inventory = inv;
    });

    //https://github.com/seishun/node-steam/blob/master/lib/generated/steam_language.js
    switch (friendtype) {
        case 0:
            console.log('Bot was removed as friend by: ' + steamid);
            break;
        case 2:
            if (config.isBanned(steamid)) {
                console.log("Banned user (" + steamid + ") tried adding bot");
            } else {
                bot.addFriend(steamid);
                console.log(steamid + ' added me as friend. I have accepted');
            }
            break;
        case 3:
            console.log('Bot is now friends with: ' + bot.users[steamid].playerName);
            listTrades(steamid);
            break;
    }
});
示例#21
0
	client.on('error', function(err){
		if(badconnects >= 10){ throw new Error('Over 10 bad connects. Err: ' + err); }
		badconnects += 1;

		winston.warn('Steam error: (' + err + '). Attempting reconnect.');
		client.connect();
	});
示例#22
0
文件: index.js 项目: jamal/gatherbot
	test: function(user, channel, parts) {
		_debug('irc', 'test');
		for (var nick in ircToSteam) {
			var steamId = ircToSteam[nick];
			_debug('irc', 'sending message to ' + nick + ' with steam ID ' + steamId);
			steamClient.sendMessage(steamId, "Test", Steam.EChatEntryType.ChatMsg);
		}
	},
示例#23
0
 Steam.on("loggedOn", function onSteamLogOn() {
     console.log("[STEAM] Logged on %s", Steam.steamID);
     Steam.setPersonaName("[YASP] " + Steam.steamID);
     steamObj[Steam.steamID] = Steam;
     Steam.replays = 0;
     Steam.profiles = 0;
     Steam.Dota2.launch();
 });
示例#24
0
文件: app.js 项目: imvision/ynbot
  bot.webLogOn(function(cookies) {
    console.log('Réception d\'un nouveau cookie:', cookies);
    cookies.split(';').forEach(function(cookie) {
        steamTrade.setCookie(cookie);
    });
	  bot.setPersonaState(Steam.EPersonaState.Online);
  console.log('Bot actuellement en ligne !');
  });
示例#25
0
 }, function (err, result) {
     if (err) {
         logger.error("Error " + err + " getting Steam guard code, quitting.");
         process.exit(1);
     } else {
         client.logOn({accountName: accountinfo.username, password: accountinfo.password, authCode: result.authcode});
     }
 });
示例#26
0
 rl.question('Steam Guard Code: ', function(code) {
     // Try logging on again
     client.logOn({
         accountName: username,
         password: password,
         authCode: code
     });
 });
示例#27
0
 bot.on('relationships', function () {
     log('Relationships loaded');
     bot.setPersonaState(Steam.EPersonaState.Online);
     /*log('Steam friends list: '+String(Steam.friends));
     Steam.friends && Steam.friends.forEach(function(steamID) {
         log(String(steamID));
     });*/
 });
示例#28
0
 bot.on('friend', function (steamID, relationshipStatus) {
     //log('Friend Activity!');
     if(relationshipStatus == Steam.EFriendRelationship['RequestRecipient']) {
         //log('Pending friend request!');
         bot.addFriend(steamID);
         log('Added ' + String(steamID) + ' to friends list');
     }
 });
示例#29
0
文件: app.js 项目: imvision/ynbot
bot.on('message', function(source, message, type, chatter) {
  if (message != '')
  {
	  console.log('Steam ID de l\'envoyeur : ' + source);
	  console.log('Pseudo de l\'envoyeur : ' + bot.users[source].playerName);
	  console.log('Message Recu : ' + message);
	  if (source == '76561198002996534') {
		bot.sendMessage(source, 'Salut Yadaskouille !', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
	  }
	  else if (source == '76561198062540850') {
		bot.sendMessage(source, message, Steam.EChatEntryType.ChatMsg);
	  }
	  else if (source == '76561198025968923') {
		bot.sendMessage(source, 'Oooooh YUYU !! Bisous ?', Steam.EChatEntryType.ChatMsg);
	  }
  }
});
示例#30
0
 client.webLogOn(function(cookie) {
     cookie.forEach(function(part) { // Share the cookie between libraries
         trade.setCookie(part.trim()); // Now we can trade!
     });
     logger.info('Logged into web');
     // No longer appear offline
     client.setPersonaState(steam.EPersonaState.LookingToTrade); 
 });