Advertisement
Guest User

Untitled

a guest
Jan 15th, 2018
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. var SteamUser = require('steam-user');
  2. var SteamTotp = require('steam-totp');
  3. var botFactory = {};
  4.  
  5. botFactory.buildBot = function (config)
  6. {
  7. var bot = new SteamUser({
  8. promptSteamGuardCode: false,
  9. dataDirectory: "./sentry",
  10. singleSentryfile: false
  11. });
  12.  
  13. bot.username = config.username;
  14. bot.password = config.password;
  15. bot.sharedSecret = config.sharedSecret;
  16. bot.games = config.games;
  17. bot.messageReceived = {};
  18.  
  19. bot.on('loggedOn', function(details) {
  20. console.log("[" + this.username + "] Serviço online Steam " + bot.steamID.getSteam3RenderedID());
  21. bot.setPersona(SteamUser.EPersonaState.Online);
  22. bot.gamesPlayed(this.games);
  23. });
  24.  
  25. bot.on('error', function(e) {
  26. console.log("[" + this.username + "] " + e);
  27. setTimeout(function() {bot.doLogin();}, 30*60*1000);
  28. });
  29.  
  30. bot.doLogin = function ()
  31. {
  32. this.logOn({
  33. "accountName": this.username,
  34. "password": this.password
  35. });
  36. }
  37.  
  38. bot.on('steamGuard', function(domain, callback) {
  39. if ( !this.sharedSecret ) {
  40. var readlineSync = require('readline-sync');
  41. var authCode = readlineSync.question("[" + this.username + "] " + 'Steam Guard Email' + (!domain ? ' App' : '') + ' Code: ');
  42. callback(authCode);
  43. }
  44. else {
  45. var authCode = SteamTotp.generateAuthCode( this.sharedSecret );
  46. console.log("[" + this.username + "] Gerando o Código Autenticador: " + authCode);
  47. callback(authCode);
  48. }
  49.  
  50. });
  51.  
  52. bot.on("friendMessage", function(steamID, message) {
  53. console.log("[" + this.username + "] Mensagem recebida " + steamID+ ": " + message);
  54. if ( !this.messageReceived[steamID] ) {
  55. bot.chatMessage(steamID, "[Auto Mensagem] Estou Offline No Momento, Steam Online na VPS (PAPALEGUAS SYSTEM) TEAMSPEAK:192.99.241.218:3022");
  56. this.messageReceived[steamID] = true;
  57. }
  58. });
  59.  
  60.  
  61. bot.on('vacBans', function(numBans, appids) {
  62. if(numBans > 0) {
  63. console.log( "[" + this.username + "] " + numBans + " VAC ban" + (numBans == 1 ? '' : 's') + "." +
  64. (appids.length == 0 ? '' : " In apps: " + appids.join(', ')) );
  65. }
  66. });
  67.  
  68. bot.on('accountLimitations', function(limited, communityBanned, locked, canInviteFriends) {
  69. var limitations = [];
  70.  
  71. if(limited) {
  72. limitations.push('LIMITED');
  73. }
  74.  
  75. if(communityBanned) {
  76. limitations.push('COMMUNITY BANNED');
  77. }
  78.  
  79. if(locked) {
  80. limitations.push('LOCKED');
  81. }
  82.  
  83. if(limitations.length !== 0) {
  84. console.log("[" + this.username + "] Limitations: " + limitations.join(', ') + ".");
  85. }
  86. });
  87.  
  88. return bot;
  89. }
  90.  
  91. module.exports = botFactory;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement