Git Product home page Git Product logo

Comments (9)

andrewda avatar andrewda commented on August 31, 2024

Hi, could you post the full error message?

from node-steam-guide.

2cab avatar 2cab commented on August 31, 2024

Hi, could you post the full error message?

(btw im using node 12.16.1 which is the current recomended one and have tried downloading different versions of the module and nothing has worked and i cant figure out how to fix the code so idk what to do bc that is not the only file that has come up with similar errors)

succesfully logged on.
C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\connection.js:21
        this._connection.stream.setTimeout(0);
                                ^

TypeError: Cannot read property 'setTimeout' of undefined
    at SteamUser.<anonymous> (C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\connection.js:21:26)
    at C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\classes\HandlerManager.js:37:12
    at Array.forEach (<anonymous>)
    at HandlerManager.emit (C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\classes\HandlerManager.js:36:12)
    at SteamUser._handleMessage (C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\messages.js:545:24)
    at SteamUser._handleNetMessage (C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\messages.js:480:7)
    at TCPConnection._readMessage (C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\connection_protocols\tcp.js:193:12)
    at Socket.emit (events.js:311:20)
    at emitReadable_ (_stream_readable.js:562:12)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)

from node-steam-guide.

2cab avatar 2cab commented on August 31, 2024

any thoughts?

from node-steam-guide.

2cab avatar 2cab commented on August 31, 2024

`succesfully logged on.
Connected to tf2 game server.
Loaded our backpack.
craft error.
craft error.
C:\Users\serbe\Downloads\bot\node_modules\bytebuffer\dist\bytebuffer-node.js:2764
throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.length);
^

RangeError: Illegal range: 0 <= 8 <= 2068278345 <= 96
at ByteBuffer.module.exports.ByteBufferPrototype.slice (C:\Users\serbe\Downloads\bot\node_modules\bytebuffer\dist\bytebuffer-node.js:2764:23)
at SteamUser._handleNetMessage (C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\messages.js:453:69)
at TCPConnection.readMessage (C:\Users\serbe\Downloads\bot\node_modules\steam-user\components\connection_protocols\tcp.js:193:12)
at Socket.emit (events.js:311:20)
at emitReadable
(_stream_readable.js:562:12)
at processTicksAndRejections (internal/process/task_queues.js:83:21)`

found some other non working code

from node-steam-guide.

andrewda avatar andrewda commented on August 31, 2024

@2cab hmm, I'm not sure, but looks like you're using some custom code that's not in the guide. I'll need to see all the code you're using to help diagnose.

from node-steam-guide.

2cab avatar 2cab commented on August 31, 2024

when i install the steam-user file it downloads allot of other files in the node-module folder

from node-steam-guide.

andrewda avatar andrewda commented on August 31, 2024

That's expected. Please post the code you're trying to run here.

from node-steam-guide.

2cab avatar 2cab commented on August 31, 2024
const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');
const SteamCommunity = require('steamcommunity');
const TradeOfferManager = require('steam-tradeoffer-manager');
const TeamFortress2 = require('tf2');


const Prices = require('./prices.json');
const config = require('./config.json');

const client = new SteamUser();
const tf2 = new TeamFortress2(client);
const community = new SteamCommunity();
const manager = new TradeOfferManager({
	steam: client,
	community: community,
	language: 'en'
});


const logOnOptions = {
  accountName: 'config.username',
  password: 'config.password',
  twoFactorCode: SteamTotp.generateAuthCode('config.sharedSecret')
};

client.logOn(logOnOptions);


	console.log('succesfully logged on.');
client.on('loggedOn', () => {
	
	client.setPersona(SteamUser.EPersonaState.Online);
	client.gamesPlayed(440);
});
	
client.on("friendMessage", function(steamID, message) {
	if (message == "!rules") {
		client.chatMessage(steamID, "This bot is made for tradeing and you should not try to exploit this bot because it can log errors and ban you so trying to brake the trade is not allowed (This also includes continous attempts to underpay the bots price listings) Thanks!")
	}
});

client.on('friendRelationship', (steamid, relationship) => {
  	if (relationship === 2) {
  		client.addFriend(steamid);
  		client.chatMessage(steamid, 'Hello there! Thanks for adding this Bot!');
  	}
  });

client.on('webSession', (sessionid, cookies) => {
	manager.setCookies(cookies);

	community.setCookies(cookies);
	community.startConfirmationChecker(20000, 'config.IdentitySecret');
});

client.logOn(logOnOptions);

client.on('loggedOn', () => {
});

function acceptOffer(offer) {
	offer.accept((err) => {
		if (err) console.log("There was an error accepting the offer")
	});
}

function declineOffer(offer) {
	offer.decline((err) => {
		if (err) console.log("There was an error declining the offer")
	});
}

function processOffer(offer) {
	if (offer.isGlitched() || offer.state === 11) {
		console.log("Offer Was glitched, declining.");
		declineOffer(offer);
	} else if (offer.partner.getSteamID64() === '76561198408825419') {
		acceptOffer(offer);
	}else{
		var ourItems = offer.itemsToGive;
        var theirItems = offer.itemsToReceive;
        var ourValue = 0;
        var theirValue = 0;
        for (var i in ourItems) {
            var item = ourItems[i].market_name;
            if(Prices[item]) {
                ourValue += Prices[item].sell;
            } else {
                console.log("Invalid Value.");
                ourValue += 99999;
            }
        }
        for(var i in theirItems) {
            var item= theirItems[i].market_name;
            if(Prices[item]) {
                theirValue += Prices[item].buy;
            } else {
            console.log("Their value was different.")
            }
        }
   
    console.log("Our value: "+ourValue);
    console.log("Their value: "+theirValue);
 
    if (ourValue <= theirValue) {
        acceptOffer(offer);
    } else {
        declineOffer(offer);
    }
    }
}
 
client.setOption("promptSteamGuardCode", false);
 
manager.on('newOffer', (offer) => {
     processOffer(offer);
});
 
/* Crafting */
 
var scrapAmt = 25;
var pollCraft = 30;
 
tf2.on('connectedToGC', function() {
    console.log("Connected to tf2 game server.");
});
 
tf2.on('backpackLoaded', function () {
    console.log("Loaded our backpack.");
});
 
function craftS(amtNeedScrap) {
    if (tf2.backpack == undefined) {
        console.log("unable to load backpack, can't craft.");
        return
    } else {
        console.log("attempting to craft...");
        var amtOfScrap = 0;
        for (var i = 0; i <tf2.backpack.length; i++) {
            if (tf2.backpack[i].defIndex === 5000) {
                amtOfScrap++;
            }
        }
        for (var i = 0; i <tf2.backpack.length; i++) {
            if (tf2.backpack[i].defIndex === 5002) {
                amtOfScrap +=9;
                var beep = new Array;
                beep.push(parseInt(tf2.backpack[i].id));
                tf2.craft(beep);
 
    } else if (tf2.backpack[i].defIndex === 5001) {
                amtOfScrap +=3;
                var beep = new Array;
                beep.push(parseInt(tf2.backpack[i].id));
                tf2.craft(beep);
            }
            if (amtOfScrap >= amtNeedScrap) {
                break;
            }
        }
           
 
    }
}
 
tf2.on('craftingComplete', function(e) {
    console.log("Finished crafting.");
});
 
client.on('friendMessage#'+'76561198408825419', function(steamID, message) {
    if (message == "craft") {
        craftS(scrapAmt);
        console.log("Recieved order to craft from admin.")
    } else {
        console.log("craft error.")
    }
});
 
 client.on("friendMessage", function(steamID, message) {
	if (message == "hi") {
		client.chatMessage(steamID, "Hewo! :)")
	}
});

setInterval(function() {
    craftS(scrapAmt);
}, 1000 * 60 * pollCraft)

from node-steam-guide.

2cab avatar 2cab commented on August 31, 2024

I think that it is the vulnerabilities in the modules because when i download them and do in cmd "npm audit" it show what has the problems

  Manual Review
             Some vulnerabilities require your attention to resolve

          Visit https://go.npm.me/audit-guide for additional guidance


  Low             Directory Traversal

  Package         send

  Patched in      >= 0.8.4

  Dependency of   totp

  Path            totp > phpjs > send

  More info       https://npmjs.com/advisories/32


  Low             Root Path Disclosure

  Package         send

  Patched in      >=0.11.1

  Dependency of   totp

  Path            totp > phpjs > send

  More info       https://npmjs.com/advisories/56


  Low             Incorrect Handling of Non-Boolean Comparisons During
                  Minification

  Package         uglify-js

  Patched in      >= 2.4.24

  Dependency of   require

  Path            require > uglify-js

  More info       https://npmjs.com/advisories/39


  Low             Regular Expression Denial of Service

  Package         uglify-js

  Patched in      >=2.6.0

  Dependency of   require

  Path            require > uglify-js

  More info       https://npmjs.com/advisories/48


  High            Regular Expression Denial of Service

  Package         minimatch

  Patched in      >=3.0.2

  Dependency of   totp

  Path            totp > phpjs > glob > minimatch

  More info       https://npmjs.com/advisories/118


  High            Regular Expression Denial of Service

  Package         minimatch

  Patched in      >=3.0.2

  Dependency of   totp

  Path            totp > phpjs > mocha > glob > minimatch

  More info       https://npmjs.com/advisories/118


  Critical        Command Injection

  Package         growl

  Patched in      >=1.10.2

  Dependency of   totp

  Path            totp > phpjs > mocha > growl

  More info       https://npmjs.com/advisories/146


  Moderate        Remote Memory Exposure

  Package         request

  Patched in      >=2.68.0

  Dependency of   steam-community [dev]

  Path            steam-community > request

  More info       https://npmjs.com/advisories/309


  High            Regular Expression Denial of Service

  Package         fresh

  Patched in      >= 0.5.2

  Dependency of   totp

  Path            totp > phpjs > send > fresh

  More info       https://npmjs.com/advisories/526


  Moderate        Regular Expression Denial of Service

  Package         mime

  Patched in      >= 1.4.1 < 2.0.0 || >= 2.0.3

  Dependency of   totp

  Path            totp > phpjs > send > mime

  More info       https://npmjs.com/advisories/535

found 10 vulnerabilities (4 low, 2 moderate, 3 high, 1 critical) in 597 scanned packages
  10 vulnerabilities require manual review. See the full report for details.

from node-steam-guide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.