-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPM modules are broken and have wrong code #102
Comments
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)
|
any thoughts? |
`succesfully logged on. RangeError: Illegal range: 0 <= 8 <= 2068278345 <= 96 found some other non working code |
@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. |
when i install the steam-user file it downloads allot of other files in the node-module folder |
That's expected. Please post the code you're trying to run here. |
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) |
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
|
so basically when i launch bot,js under node.js it will say that the module file manager has a syntax error:unexpected token (
this is what the code looks like
FileManager.prototype.saveFiles = FileManager.prototype.writeFiles = function(files) {
return new Promise(async (resolve, reject) => {
try {
await Promise.all(Object.keys(files).map(filename => this.saveFile(filename, files[filename])));
resolve();
} catch (ex) {
reject(ex);
}
});
};
it also lists many other proplems with other files
The text was updated successfully, but these errors were encountered: