websteam
v1.0.1
Published
Node Steam Community
Downloads
7
Maintainers
Readme
node-websteam
Warning
Steam has banned bots before for buying and selling e.g. TF2 keys for a profit. I am not responsible if anything happens to your Steam account when using this. For support on a ban, do not contact me, instead contact the Steam Support.
Quick and easy
var WebSteam = require('websteam');
var MyUser = new WebSteam.User();
MyUser.Login("MyAccountName", "MyBase64EncryptedPassword", "GUARDCODE", function(err, code) {
if(err) throw err;
if(code === 0) {
// You are already logged in!
} else if(code === 1) {
// You are now logged in
} else if(code === 2) {
// You need a SteamGuard code
} else if(code === 3 || code === 4) {
// Error
}
});
WebSteam.User(options)
The user class, required for accessing everything else. Setting the DEBUG
environment variable to SteamClass:User
(See debug) you will be able to see all errors and debugging messages. No options are required. Options are:
CookieJar
- A WebSteam.CookieJar object. Useful when loading cookies from a JSON file using CookieJar.fromJSON(string)Username
- The Steam Login name.Currency
- The currency integer;1
- USD2
- GBP3
- Euro
User.Login(Username, Password, SteamGuardCode, Callback)
Logs the user in using the given credentials.
Username
is the username you use to login on Steam.Password
is the password, which has to be Base64 encoded.SteamGuardCode
is the Steam Guard code, which you receive in your inbox after a failed (code 2) login.Callback(err, code)
is the callback after the function is done logging in or has failed. Possible codes are:0
- You are already logged in, your cookie jar contains a session which is still valid.1
- You are now logged in.2
- Either your Steam Guard code is invalid, or you didn't give one but is required.3
- The login returned with a readable error message, checkerr
.4
- An unknown error has shown up, checkerr
.
User.GetSteamCommunityID(Callback)
Your Steam Community ID (steamcommunity.com/id/example) is not set after the Login, you need to call this before accessing User.SteamCommunityID
.
Callback(err, id)
is called when it has found the username or has failed to (err
). If it can't find the ID,id
returns0
.
User.GetSessionID()
Because, just like the Steam Community ID, User.SessionID
is not set yet, you need to call this. This tries to retrieve the Session ID from the CookieJar. The function returns a bool, which is either true
if it has successfully found it, or false
if it failed to do so.
User.GetMissingCards(AppID, Callback)
Gets the missing cards for crafting a badge from the Game AppID
.
AppID
is the App ID which has to have the trading cards feature.Callback(err, items)
is called when it has found the required items or has failed. The items variable is an array that contains the item hashes of the missing cards.
User variables
User.CookieJar
is aWebSteam.CookieJar
.User.rCookieJar
is Request's version of the CookieJar (request.jar(User.CookieJar)
).User.Username
is the user's login name.User.SteamCommunityID
is the Steam Community ID. This is empty untilUser.GetSteamCommunityID
found it.User.LoggedIn
istrue
if the user is logged in,false
otherwise.User.PublicKeyMod
is the Public Key Modulus, required for encrypting the password for logging in (SteamEncrypt.js).User.PublicKeyExp
is the Public Key Exponent, idem.User.SessionID
is the Session ID. SeeUser.GetSessionID
User.Currency
is the currency the account is using, see above for values. Defaults to1
(USD).
WebSteam.MarketItem(options)
Class for using the market for things like checking items or creating buy orders. Setting the DEBUG
environment variable to SteamClass:MarketItem
(See debug) you will be able to see all errors and debugging messages. Options are:
ItemHash
- The item's hash, can be found at the end of the item's url (e.g. steamcommunity.com/market/listings/753/4000-Invasion).AppID
- The App ID, can also be found in the url (e.g. steamcommunity.com/market/listings/753/4000-Invasion)User
- The User (WebSteam.User
class) that sees the item.
MarketItem.GetPrice(Callback)
Finds the price and available amount of the item.
Callback(err, success)
is called on success or failure.success
is true on success.
MarketItem.Buy(Amount, Price, Callback)
Creates a buy order for the item.
Amount
is the amount of items you want to buy at once.Price
is the price you pay for this item. Note: this is an integer, this means it cannot have decimals. For e.g. $2.19 use219
.Callback(err, buyorderid)
is called on success or failure.buyorderid
is0
if the buy order is not created.
MarketItem variables
MarketItem.SessionID
is the SessionID, retrieved fromWebSteam.User
MarketItem.AppID
is the App ID (Seeoptions
)MarketItem.ItemHash
is the Item hash (idem)MarketItem.Price
is the price afterMarketItem.GetPrice
($2.19 becomes219
)MarketItem.Amount
is the amount of items available afterMarketItem.GetPrice
MarketItem.Currency
is the currency, see above.MarketItem.User
is the User class (WebSteam.User
).