Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Steam = require("steam"),
- sleep = require('sleep');
- util = require("util"),
- fs = require("fs"),
- csgo = require("csgo"),
- bot = new Steam.SteamClient(),
- steamUser = new Steam.SteamUser(bot),
- steamFriends = new Steam.SteamFriends(bot),
- steamGC = new Steam.SteamGameCoordinator(bot, 730),
- CSGOCli = new csgo.CSGOClient(steamUser, steamGC, true),
- crypto = require("crypto");
- Steam.servers = JSON.parse(`[{"host":"155.133.242.9","port":27018},{"host":"185.25.180.15","port":27019},{"host":"185.25.180.15","port":27018},{"host":"185.25.180.14","port":27017},{"host":"185.25.180.15","port":27017},{"host":"155.133.242.9","port":27019},{"host":"155.133.242.9","port":27017},{"host":"185.25.180.14","port":27018},{"host":"185.25.180.14","port":27019},{"host":"155.133.242.8","port":27017},{"host":"155.133.242.8","port":27018},{"host":"155.133.242.8","port":27019},{"host":"162.254.197.40","port":27018},{"host":"155.133.248.50","port":27017},{"host":"155.133.248.51","port":27017},{"host":"162.254.196.68","port":27017},{"host":"162.254.197.41","port":27017},{"host":"162.254.196.67","port":27019},{"host":"155.133.248.53","port":27018},{"host":"155.133.248.52","port":27018},{"host":"162.254.196.67","port":27017},{"host":"162.254.196.67","port":27018},{"host":"162.254.196.83","port":27017},{"host":"162.254.196.84","port":27017},{"host":"155.133.248.52","port":27017},{"host":"162.254.196.68","port":27018},{"host":"162.254.197.40","port":27019},{"host":"155.133.248.51","port":27019},{"host":"155.133.248.52","port":27019},{"host":"155.133.248.53","port":27019},{"host":"155.133.248.50","port":27019},{"host":"155.133.248.53","port":27017},{"host":"162.254.196.68","port":27019},{"host":"162.254.197.42","port":27019},{"host":"162.254.196.84","port":27018},{"host":"155.133.248.50","port":27018},{"host":"162.254.196.83","port":27019},{"host":"162.254.197.42","port":27018},{"host":"162.254.197.41","port":27018},{"host":"162.254.196.84","port":27019},{"host":"162.254.196.83","port":27018},{"host":"162.254.197.40","port":27017},{"host":"162.254.197.41","port":27019},{"host":"155.133.248.51","port":27018},{"host":"162.254.197.42","port":27017},{"host":"146.66.152.11","port":27018},{"host":"146.66.152.11","port":27019},{"host":"146.66.152.11","port":27017},{"host":"146.66.152.10","port":27019},{"host":"146.66.152.10","port":27017},{"host":"146.66.152.10","port":27018},{"host":"208.78.164.10","port":27018},{"host":"208.78.164.9","port":27019},{"host":"208.78.164.13","port":27018},{"host":"208.78.164.9","port":27017},{"host":"208.78.164.12","port":27018},{"host":"208.78.164.10","port":27017},{"host":"155.133.229.251","port":27019},{"host":"155.133.229.251","port":27017},{"host":"208.78.164.14","port":27018},{"host":"208.78.164.12","port":27019},{"host":"208.78.164.13","port":27017},{"host":"208.78.164.9","port":27018},{"host":"208.78.164.14","port":27019},{"host":"208.78.164.11","port":27018},{"host":"208.78.164.10","port":27019},{"host":"155.133.229.250","port":27017},{"host":"208.78.164.12","port":27017},{"host":"208.78.164.11","port":27019},{"host":"155.133.229.250","port":27018},{"host":"155.133.229.251","port":27018},{"host":"208.78.164.11","port":27017},{"host":"155.133.229.250","port":27019},{"host":"208.78.164.13","port":27019},{"host":"208.78.164.14","port":27017},{"host":"162.254.193.7","port":27017},{"host":"162.254.193.47","port":27019},{"host":"162.254.193.7","port":27018},{"host":"162.254.193.46","port":27018},{"host":"162.254.193.6","port":27017}]`);
- /* Decoding Share Codes */
- var scDecoder = new csgo.SharecodeDecoder("CSGO-U6MWi-hYFWJ-opPwD-JciHm-qOijD");
- //console.log("Sharecode CSGO-U6MWi-hYFWJ-opPwD-JciHm-qOijD decodes into: ");
- //console.log(scDecoder.decode());
- function MakeSha(bytes) {
- var hash = crypto.createHash('sha1');
- hash.update(bytes);
- return hash.digest();
- }
- var onSteamLogOn = function onSteamLogOn(response){
- // online gehen und namen setzen
- steamFriends.setPersonaState(Steam.EPersonaState.Online);
- steamFriends.setPersonaName("OnlineGamingUnited.de");
- //util.log("Bot Current SteamID64: " + bot.steamID);
- // util.log("Bot Account ID: " + CSGOCli.ToAccountID(bot.steamID));
- steamFriends.on('clanState', function(clanState) {
- if (clanState.announcements.length) {
- console.log('Group with SteamID ' + clanState.steamid_clan + ' has posted ' + clanState.announcements[0].headline);
- }
- });
- steamFriends.on('message', function(source, message, type, chatter) {
- console.log("Message from "+source+": "+message);
- // respond to both chat room and private messages
- if (message == '!help') {
- steamFriends.sendMessage(source, 'Gib einen der folgenden Befehle hier im Chat ein:', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
- steamFriends.sendMessage(source, '!help: Zeigt dir diese Hilfe an.', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
- steamFriends.sendMessage(source, '!play <game>: Start die Mitspielersuche für das Spiel <game>', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
- steamFriends.sendMessage(source, '!games: Zeigt die Liste an verfügbaren Spielen', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
- steamFriends.sendMessage(source, '!stfu: Muted den Bot für zwei Stunden (nochmal !stfu schreiben zum vorzeitigen entmuten)', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
- }
- });
- if (response.eresult == Steam.EResult.OK) {
- //util.log('#### Logged in into Steam! ####');
- }
- else
- {
- util.log('######### ERROR logging in into Steam ####, ', response);
- process.exit();
- }
- //steamFriends.addFriend("76561197960370859");
- // CS starten
- CSGOCli.launch();
- steamUser.on("lobbyInvite", function(steamID, inviterID, lobbyID) {
- util.log("LOBBY INVITE");
- util.log("inviterID"+inviterID);
- util.log("lobbyID"+lobbyID);
- //util.log(steamID);
- });
- CSGOCli.on("ready", function() {
- steamUser.on("lobbyInvite", function(steamID, inviterID, lobbyID) {
- util.log("LOBBY INVITE");
- util.log("inviterID"+inviterID);
- util.log("lobbyID"+lobbyID);
- //util.log(steamID);
- });
- // GOOSE: 76561197961048988
- // Eckel: 76561197992574513
- // EFF: 76561197960370859
- // bot.steamID
- /* CSGOCli.playerProfileRequest(CSGOCli.ToAccountID("76561197961048988"));
- sleep.sleep(2);
- CSGOCli.playerProfileRequest(CSGOCli.ToAccountID("76561197992574513"));
- sleep.sleep(2);
- CSGOCli.playerProfileRequest(CSGOCli.ToAccountID("76561197960370859"));
- sleep.sleep(2);
- CSGOCli.playerProfileRequest(CSGOCli.ToAccountID(bot.steamID));
- sleep.sleep(2);*/
- CSGOCli.on("playerProfile", function(profile) {
- console.log("Player Rank: " + CSGOCli.Rank.getString(profile.account_profiles[0].ranking.rank_id))
- /*console.log(JSON.stringify(profile, null, 2));*/
- });
- //CSGOCli.matchmakingStatsRequest();
- CSGOCli.on("matchmakingStatsData", function(matchmakingStatsResponse) {
- util.log("Avg. Wait Time: " + matchmakingStatsResponse.global_stats.search_time_avg);
- //CSGOCli.requestRecentGames();
- CSGOCli.on("matchList", function(list) {
- //console.log("Match List");
- if (list.matches && list.matches.length > 0) {
- // console.log(list.matches[0]);
- }
- });
- /*
- CSGOCli.richPresenceUpload({
- RP: {
- status: "Hello World!", // Sets rich presence text to "Hello World!"
- version: 13508, // Not sure what this value does
- time: 161.164087, // This might be the amount of time since you have started the game, not sure.
- "game:state": "lobby",
- steam_display: "#display_Lobby",
- connect: "+gcconnectG082AA752",
- "game:mode": "casual"
- }
- });
- steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198084749846A6768147729D12557175561287951743
- CSGOCli.itemDataRequest("76561198084749846", "6768147729", "12557175561287951743", "0");
- CSGOCli.on("itemData", function(itemdata) {
- //console.log(itemdata);
- });*/
- });
- });
- steamUser.on("unready", function onUnready(){
- //util.log("node-csgo unready.");
- });
- },
- onSteamSentry = function onSteamSentry(sentry) {
- util.log("Received sentry.");
- require('fs').writeFileSync('sentry', sentry);
- }
- var username = "USERNAME";
- var password = "PW";
- var authCode = "";
- var logOnDetails = {
- "account_name": username,
- "password": password,
- };
- if (authCode !== "") {
- logOnDetails.auth_code = authCode;
- }
- var sentry = fs.readFileSync('sentry');
- if (sentry.length) {
- logOnDetails.sha_sentryfile = MakeSha(sentry);
- }
- bot.connect();
- steamUser.on('updateMachineAuth', function(response, callback){
- fs.writeFileSync('sentry', response.bytes);
- callback({ sha_file: MakeSha(response.bytes) });
- });
- bot.on("logOnResponse", onSteamLogOn)
- .on('sentry', onSteamSentry)
- .on('connected', function(){
- steamUser.logOn(logOnDetails);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement