Git Product home page Git Product logo

node-steam-guide's Introduction

Andrew's Guide to Steam Bots

Codacy PayPal Steam Donate

Creative Commons

A complete guide to building Steam bots using Node.js.

Table of Contents

(more chapters to come)

Inspiration

Many people in the /r/SteamBot and /r/SteamBotMarket communities have been looking for a complete guide to building Node.js Steam bots, but there really isn't a complete, up-to-date tutorial online anywhere. This guide is here to help out anyone and everyone who wants to learn about creating Steam bots.

When I first started creating Steam bots in the early ages about 2 years ago, it was fairly overwhelming. Trying to piece together different modules in order to form a functioning bot was a real struggle โ€“ but I'm looking help save new-comers the struggle of learning the new and modern Steam technologies.

Together, we'll learn how to make bots and connect them to websites in this multi-chapter guide.

Projects

In this course, you'll be making a number of mini-projects, which will all come together to create the final website. Eventually we'll end up with a site which can be used to make profit by selling and buying TF2 or CS:GO skins, similar to http://cs.money/.

Contributing

Please read the contribution guidelines before creating a Pull Request.

Donating

If you found this guide useful, there are a few ways for you to support me and keep this project going:

node-steam-guide's People

Contributors

andrewda avatar dentfuse avatar fedzero avatar filipbarak avatar irmandos avatar itsjw avatar maartenpaauw avatar maestrodesign avatar marcmogdanz avatar micheldaoud avatar mvegter avatar tiagoseverino avatar xmwx38 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-steam-guide's Issues

Cannot find module

Good Day,
I have been following your work (I love it) but I have run into a few issues with the latest code. (Chapter 6.1 - Getting Started)

Here is the steps I followed:

  • Verified dependancies are installed as listed. (Chapter 2.1,Chapter 4.1,Chapter 5.1)
  • Removed my folder structure, re-created the folder structure, re-installed dependancies, and downloaded the files directly from GitHub using wget.

Technical Details about my environment:

  • Ubuntu 16 xenial, hosted on the Google Cloud platform
  • Firewall enabled with exception to port 3037
  1. 1st Error

irmandos@alfred-container:~/trade-bot$ node app.js
module.js:442
throw err;
^

Error: Cannot find module 'passport.socketio'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/home/irmandos/trade-bot/app.js:5:24)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)

When I remove the const passportSocket = require('passport.socketio'); section in app.js it continues to the 2nd error

  1. 2nd Error

irmandos@alfred-container:~/trade-bot$ node app.js
module.js:442
throw err;
^

Error: Cannot find module 'connect-mongo'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/home/irmandos/trade-bot/app.js:13:20)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.runMain (module.js:575:10)
at run (node.js:348:7)
at startup (node.js:140:9)
at node.js:463:3

When I remove the const MongoStore = require('connect-mongo')(session); section in app.js it continues to the 3rd error.

  1. 3rd Error

irmandos@alfred-container:~/trade-bot$ node app.js
/home/irmandos/trade-bot/app.js:28
const sessionStore = new MongoStore({ mongooseConnection: mongoose.connection });
^

ReferenceError: MongoStore is not defined
at Object. (/home/irmandos/trade-bot/app.js:28:26)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.runMain (module.js:575:10)
at run (node.js:348:7)
at startup (node.js:140:9)
at node.js:463:3

Error, while getting confirmations list.

Hi,
I am using my shared key which I got by https://github.com/Jessecar96/SteamDesktopAuthenticator. For authorization which uses "steam-totp" all codes generated correct and working fine:

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

but when I try to use checkConfirmation with autostart it generates error.

community.startConfirmationChecker(10000, config.steam.sharedSecret);

error is below:

It looks like your Steam Guard Mobile Authenticator is providing incorrect Steam Guard codes. This could be caused by an inaccurate clock or bad timezone settings on your device. If your time settings are correct, it could be that a different device has been set up to provide the Steam Guard codes for your account, which means the authenticator on this device is no longer valid.

Maybe I did mistake here? Thanks for any support :)

Adding features/ideas!

Hello guys, can you try to add some features, like:

  • Multiple bot login system (on same app.js or bot.js)
  • Pricing on each item: for example a pricing database (csgofast or others)
  • Minimum price per item: for example bot will instantly deny items below the config that gave them
  • Manipulate/Custom prices for each item: for exmaple we got prices from csgofast, 1 random key is 2.54โ‚ฌ, we want to key to be 2.50.

ReferenceError: config is not defined

i'm facing another issue here...
hopefully this will be the last
error
config.json and app.js are in the same folder
inside config.json i've entered a valid secret string and api key but still getting this error message
sorry for my poor English.

Items duplicating when restarting server

So for some reason, every time I re-run app.js, the list just duplicates its self and adds more to the document as shown here:
image

I am unsure if this is how it was intended, however clearly duplicates are not something we want around.

My code so far:

const express = require('express');
const handlebars = require('express-handlebars');
const path = require('path');
const mongoose = require('mongoose');

const Item = require('./models/item');
const app = express();
const hbs = handlebars.create();

mongoose.connect('mongodb://127.0.0.1:27017/guide', {useMongoClient: true});
mongoose.Promise = global.Promise;

app.engine('hbs', hbs.engine);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');

// Item Table?
const awpAsiimov = new Item({
    name: 'AWP | Asiimov (Field-Tested)',
    price: 27.75
});

const akRedline = new Item({
    name: 'AK-47 | Redline (Field-Tested)',
    price: 5.52
});


awpAsiimov.save((err, item) => {
    if (err) {
        console.log(err);
    } else {
        console.log(item);
    }
});

akRedline.save((err, item) => {
    if (err) {
        console.log(err);
    } else {
        console.log(item);
    }
});

app.get('/', (req, res) => {
	Item.find({}, (err, items) => {
		if (err) {
			console.log(err);
		}
		res.render('main', { items });
	});
});

app.listen(3037);

ignore the useMongClient and mongoose.promise, those were for getting rid of the errors.

Page timing out

I tried project 10 on vps server and the page did not load in time. I checked the console and it said that the app was listening (i made the connection on port 5000 instead of 3037) , the bot was working , i had all the modules necessary. I cant see why the page is timing out. Do i need to write the domain name instead of localhost:5000 or am i missing something?
Edit: I checked and saw that it was the socket taking too long to connect with the user. Its probably because im using NGINX to reverse proxy requests (to setup https sertificate). Any suggestions how to fix it ?

donations

the bot isnt accepting it? is it because it is a limited account

syntax error

/home/bot/node_modules/steam-totp/index.js:28
let code = exports.generateAuthCode(secret, offset);
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/home/bot/bot.js:5:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
root@csgowoob:/home/bot# /home/bot/node_modules/steam-totp/index.js:28
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/home/bot/bot.js:5:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

Adding credits

Hello. I used your code as a base to try and make some project of mine and now i want to add credits on each user. Should i add it in the database collection User or should i create a separate Credits collection. If I want to implement credits on the User model how should i go on about updating the info when i serialize the user ? I want to use the credits property as "req.user.credits". How do i do that ?

Add details to "Chapter 4.4 - Databases"

It would be very helpful if you add more details to "Chapter 4.4 - Databases" & go over basic usage.
Some things to cover:

  • Using Firebase instead of MongoDB;
  • Installation of mongod command;
  • Starting mongod service.

Price checking

It would be very helpful if you show how to do price checking from database!
Thanks,

items from withdraw dosen't load

Hi i can see any items in the withdraw page i tried to do all the tutorials by myself and i tried with your files but same result maybye an error from mongod ? Best regards

Chapter 6.2 main.js isnt working.

Hi, i just started yesterday trying to do my own project Play4Skins, that isnt for cs go btw. I created sourcemod plugin etc, but im very confused with site. Im trying to do SOMETHING with site "just a few hours"... Can you help me with site? Or someone who can? Nah, that isnt the problem... The problem is:
When i click on deposit items or on withdraw items theres nothing doing. No alerts, no sockets.

chapter 2-2: bot doesn't react to new tradeoffers

I followed your guide (thank you a lot btw) and everything went smooth so far, now I'm stuck though as the bot won't react to sent tradeoffers. From what I understand the even newOffer is never registered (I could be wrong I'm pretty new to coding). The bot definitely does get the offers, I can even log into the account and accept them manually. I downloaded your code and tried with that still no luck. Any help would be appreciated!

steam-totp issue

hey, i just started learning, it's cool!
but I ran into the issue, I read that the steam guard app code thing would be automated but I gotta enter it myself, I used my own code then I tried the example one, still, doesnt work and I took the correct stuff
im sure that i used the correct values, cause i took them from steam desktop authenticator
anyone else ran into this issue and fixed it?

Spacing is inconsistent

I believe I saw a markdown prettier linter a while ago. Would be good to incorporate that and a pre-commit hook.

module not found

i installed the thing four times and it keeps saying the same thing
module.js:338
throw err;
^
Error: Cannot find module 'C:\Users\NAME\Documents\node-steam-guide-master\project1.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

Donations

I tried sending it a tf2 item and it didnt accept it...

Possible with web hosting service? (PHP)

Leaving aside how much more complicated it would be to do this through a web hosting service. Mainly because this tutorial (which looks like a great tutorial) won't help me with that. My question is simply: Is there a way to make automatic trading using PHP instead of node.js? And also, using a web hosting service vs using my own home server, do I even have enough access to even be able to do the things needed for sending automatic trade requests.

Alternatively, it it possible to handle the automatic bot trading using node.js on my home machine and having it communicate with my website (PHP) hosted by a web hosting service.

Thank you.

Check arguments

!test hello

if argument is hello send message. How can do it?

trade

I start the bot normally, And when I am giving it a trade nothing happens

Cannot overwrite `User` model once compiled.

Hey everyone!
i have put all the code step by step in my files and named them exactly the same as the guide
i have mongodb and nodejs installed and running and i'm still getting this error when i try to run app.js
capture

can anyone help me with this please
thanks in advance

4.4 Database.

Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html

Is what I'm getting on the 4.4 after trying to launch project6.js

could you explain how to set up the database as well? as on the tutorial it says nothing about how to create or view it in the first place.

Thanks

Problem saving information in database

Hello.
I tried running project 6 and it seems to be working fine , exept one thing : It doesn't save any information to the database. I checked using mongo and it had database "guide" that had 3 collections: "prices" , "sessions" and "users" , none of them had any info. It also desn't show anything in the withdraw page on the app.
How do i get them to run properly ?

Next problem with steam-totp !

When I add twoFactorCode: SteamTotp.generateAuthCode('my shared secret key') he was crashing the console ! He was working when i add this steam-totp :(

Andrewda please help

It keeps saying InvalidPassword

Error: InvalidPassword
at SteamUser._handlers.(anonymous function) (/Users/wolfy/Desktop/Steambot/node_modules/steam-user/components/logon.js:363:16)
at SteamUser._handleMessage (/Users/wolfy/Desktop/Steambot/node_modules/steam-user/components/messages.js:216:29)
at emitThree (events.js:116:13)
at CMClient.emit (events.js:194:7)
at CMClient._netMsgReceived (/Users/wolfy/Desktop/Steambot/node_modules/steam-client/lib/cm_client.js:323:8)
at CMClient.handlers.(anonymous function) (/Users/wolfy/Desktop/Steambot/node_modules/steam-client/lib/cm_client.js:603:8)
at CMClient._netMsgReceived (/Users/wolfy/Desktop/Steambot/node_modules/steam-client/lib/cm_client.js:305:24)
at emitOne (events.js:96:13)
at TCPConnection.emit (events.js:188:7)
at TCPConnection._readPacket (/Users/wolfy/Desktop/Steambot/node_modules/steam-client/lib/tcp_connection.js:179:7)

Its keeps saying when I code on chapter 1.4 and above. If its a bug please fix. If not, please help me whats going on thanks.

Bot ignores my tradeoffers.

Here's the code;
`const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');
const SteamCommunity = require('steamcommunity');
const TradeOfferManager = require('steam-tradeoffer-manager');

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

const logOnOptions = {
accountName: 'MY_LOGIN_HERE',
password: 'MY_PASSWORD_HERE',
twoFactorCode: SteamTotp.generateAuthCode('MY_AUTHCODE_HERE')
};

client.logOn(logOnOptions);

client.on('loggedOn', () => {
console.log('Logged into Steam');
client.setPersona(SteamUser.Steam.EPersonaState.Online);
client.gamesPlayed("Steam Bot");
});

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

community.setCookies(cookies);
community.startConfirmationChecker(10000, 'Lu++M3MNzsf3l0FsE/jKN4X6ZkE=');

});

manager.on('newOffer', (offer) => {
if (offer.partner.getSteamID64() === '76561198360548976') {
offer.accept((err, status) => {
if (err) {
console.log(err);
} else {
console.log(Accepted offer. Status: ${status}.);
}
});
}
});`

It loggs in successfully and status is going ONLINE and everything is fine excepting the bot ignores offers and nothing is written in console. Help please.

newOffer not firing?

Why is my newOffer not firing?


manager.on('newOffer', (offer) => {
	if (offer.partner.getSteamID64() === '76561198368818576') {
		offer.accept((err, status) => {
			if (err) {
				console.log(err);
			} else {
				console.log(`Accepted offer. Status: ${status}.`);
			}
		});
	} else {
		offer.decline((err) => {
			if (err) {
				console.log(err);
			} else {
				console.log('Canceled offer from scammer.');
			}
		});
	}
});

How do you style the HBS files?

I can't see to figure out how to link the CSS file to the HBS file, even though I use the same linking method as I would in any ordinary HTML file.

Phone number

How can I confirm the phone number on my account? What method?
To use the enableTwoFactor method in steam-user package.

InternalOpenIDError: Failed to verify assertion

I met this problem in the test Chapter 6 - Connecting Sites and Bots
When steam after log in successfully returns this error
image
However I removed this code can be login successful and jump back to the main. HBS
image

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.