SHARE
TWEET

dotaBot.js

a guest May 21st, 2017 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //LOAD LIBRARIES & Files
  2. var util              =   require("util"),
  3.     fs                =   require("fs"),
  4.     crypto            =   require("crypto"),
  5.     dota2             =   require("dota2"),
  6.     steamUser         =   require('steam-user'),
  7.     steamTotp         =   require("steam-totp"),
  8.     steamCommunity    =   require('steamcommunity'),
  9.     tradeOfferManager =   require('steam-tradeoffer-manager'),
  10.     dotaTrades        =   require('./dotaTrades.js'),
  11.     steamAddFriend    =   require("./steamAddFriend.js"),
  12.     steamMsg          =   require("./steamMsg.js"),
  13.     SteamID           =   require('steamid'),
  14.  
  15.     //NODE-DOTA2 SPECIFIC
  16.     Steam             =   require('steam'),
  17.     dota2             =   require('dota2');
  18.     ///////////////////
  19.  
  20. //CREATE CLIENTS
  21. var steamUserClient         =   new steamUser(),
  22.     //NODE-DOTA2 SPECIFIC
  23.     steamClient             =   new Steam.SteamClient(),
  24.     Dota2                   =   new dota2.Dota2Client(steamClient, true, false),
  25.     steamDotaUser               =   new steamUser(steamClient),
  26.     ////////////////////////
  27.     steamCommunityClient    =   new steamCommunity(),
  28.     tradeManager            =   new tradeOfferManager({
  29.           "steam":      steamUserClient,
  30.           "language":   'en'
  31.     });
  32.  
  33. exports.gift = function (recipientSteamId, settings) {
  34.     dotaTrades.gift(recipientSteamId, settings, steamUserClient, tradeManager, tradeOfferManager);
  35. };
  36.  
  37. exports.run = function (settings, mongo, mongoClient, assert, Discord, discordClient) {
  38.  
  39.  
  40.   // Get logOn information
  41.   // var logOnDetails = {
  42.   //     accountName: settings.steamBotUsername,
  43.   //     password: settings.steamBotPswd,
  44.   //     twoFactorCode: steamTotp.generateAuthCode(settings.steamSharedSecret)
  45.   // };
  46.  
  47.  
  48.   //LOGON DETAILS FOR DOTA LOBBY
  49.   steamClient.connect();
  50.   steamClient.on('connected', function() {
  51.     steamDotaUser.logOn({
  52.       account_name: settings.steamBotUsername,
  53.       password: settings.steamBotPswd,
  54.       two_factor_code: steamTotp.generateAuthCode(settings.steamSharedSecret)
  55.     });
  56.     //Load Dota2
  57.     Dota2.launch();
  58.     Dota2.on("ready", function() {
  59.        console.log("Dota2 ready.");
  60.     });
  61.     Dota2.on("unready", function onUnready() {
  62.        console.log("Node-dota2 unready.");
  63.     });
  64.     Dota2.on("unhandled", function(kMsg) {
  65.        util.log("UNHANDLED MESSAGE " + dota2._getMessageName(kMsg));
  66.     });
  67.   });
  68. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top