SteamUser is a handler module for node-steam version 1.0.0 or greater. It also works with node-steam-client.
It's designed to be a self-contained module which provides all the functionality expected of a Steam user client.
Subscribe to release announcements
Have a question about the module or coding in general? Do not create a GitHub issue. GitHub issues are for feature requests and bug reports. Instead, post in the dedicated forum. Such issues may be ignored!
Static properties, or properties attached directly to SteamUser, are accessed on the root module and not on instantiated handler instances.
The node-steam-client module installation used by SteamUser. You can use this in place of require('steam-client')
if you'd like to avoid duplicate installations.
Example of using EResult:
var SteamUser = require('steam-user');
var ok = SteamUser.Steam.EResult.OK;An up-to-date enum of Steam's many currencies. View here
Example:
var SteamUser = require('steam-user');
var usd = SteamUser.ECurrencyCode.USD;Static methods, or functions attached directly to SteamUser, are called on the root module and not on instantiated handler instances.
amount- The amount of the currencycurrency- The currency code value in theECurrencyCodeenum
Formats a currency value and returns a string. For example:
console.log(SteamUser.formatCurrency(12.34, SteamUser.ECurrencyCode.USD)); // $12.34
console.log(SteamUser.formatCurrency(12345, SteamUser.ECurrencyCode.JPY)); // � 12345
console.log(SteamUser.formatCurrency(123.45, SteamUser.ECurrencyCode.EUR)); // 123,45�secret- ABuffer, hex string, or base64 string containing your shared secrettimeOffset- The number of seconds by which your local clock is off from the Steam servers. Defaults to 0.
Generates a 5-digit alphanumeric Steam Guard code for use with two-factor mobile authentication.
Deprecated. Use steam-totp instead.
There are a number of options which can control the behavior of the SteamUser object. They are:
Controls where the Steam server list and sentry files are written. If null, no data will be automatically stored.
Defaults to a platform-specific user data directory.
- On OpenShift, this is
$OPENSHIFT_DATA_DIR/node-steamuser - On Windows, this is
%localappdata%\doctormckay\node-steamuser - On Mac, this is
~/Library/Application Support/node-steamuser - On Linux, this is
$XDG_DATA_HOME/node-steamuser, or~/.local/share/node-steamuserif$XDG_DATA_HOMEisn't defined or is empty
If you don't want to (or can't) save data to the disk, you can implement your own storage engine. To do this, simply add the following code:
user.storage.on('save', function(filename, contents, callback) {
// filename is the name of the file, as a string
// contents is a Buffer containing the file's contents
// callback is a function which you MUST call on completion or error, with a single error argument
// For example:
someStorageSystem.saveFile(filename, contents, function(err) {
callback(err);
});
});
user.storage.on('read', function(filename, callback) {
// filename is the name of the file, as a string
// callback is a function which you MUST call on completion or error, with an error argument and a Buffer argument
// For example:
someStorageSystem.readFile(filename, function(err, file) {
if(err) {
callback(err);
return;
}
callback(null, file);
});
});In this manner, you can save data to a database, a cloud service, or anything else you choose.
A boolean which controls whether or not SteamUser will automatically reconnect to Steam if disconnected due to Steam going down.
Defaults to true.
A boolean which controls whether or not SteamUser will use a single sentry file for all accounts.
If off, a file named sentry.accountname.bin will be saved for each account.
If on, a file named sentry.bin will be used for all accounts.
Defaults to false.
A boolean which controls whether or not SteamUser will automatically prompt for Steam Guard codes when necessary from stdin.
Defaults to true.
What kind of machine ID will SteamUser send to Steam when logging on? Should be a value from EMachineIDType.
Added in 1.7.0.
Defaults to AccountNameGenerated.
If you're using machineIdType AccountGenerated, this is the format it uses. This is an array of three strings, each of which will be hashed with SHA1 before being sent to Steam. {account_name} will be replaced with the current account name.
Added in 1.13.0.
Defaults to ["SteamUser Hash BB3 {account_name}", "SteamUser Hash FF2 {account_name}", "SteamUser Hash 3B3 {account_name}"].
If enabled, then node-steam-user will internally cache data about all apps and packages that it knows about.
Currently, node-steam-user "knows about" an app/package if:
- Packages
- You own it
- You request info about it via
getProductInfo
- Apps
- It's in a known package
- You request info about it via
getProductInfo - A friend who is online plays the app
- You request info about an online user who is playing it via
getPersonas
This option is required in order to use several methods and events. This works when logging in anonymously.
Added in 3.3.0.
Defaults to false.
If enabled, enablePicsCache is enabled, and changelistUpdateInterval is nonzero, then apps and packages which get
updated while your bot is running will also be added to the cache. Default behavior is to only cache apps and packages
that are "known" via the above criteria.
Added in 3.3.0.
Defaults to false.
If enablePicsCache is enabled, then node-steam-user will automatically request app/package changes (via
getProductChanges) for known apps and packages, and update the internal cache when they update. Set to 0 to disable.
Added in 3.3.0.
Defaults to 60000.
The SteamClient which is being used to communicate with Steam.
null if not connected, a SteamID containing your SteamID otherwise.
An object containing options for this SteamUser. Read-only, use setOption or setOptions to change an option.
v1.12.0 or later is required to use this property
Only defined if you're currently logged on. This is your public IP as reported by Steam, in "x.x.x.x" format.
v1.12.0 or later is required to use this property
Only defined if you're currently logged on. This is you cell (region ID) on the Steam network.
An object containing information about your account. null until accountInfo is emitted.
name- Your account's Steam (persona) namecountry- The character code from which you're logging in (via GeoIP), e.g. "US"authedMachines- How many machines are authorized to login to your account with Steam Guardflags- Your account's bitwise flagsfacebookID- If your account is linked with Facebook, this is your Facebook account IDfacebookName- If your account is linked with Facebook, this is your (real) name on Facebook
An object containing information about your account's email address. null until emailInfo is emitted.
address- Your email addressvalidated-trueif your email is validated,falseif not
An object containing information about your account's limitations. null until accountLimitations is emitted.
limited-trueif your account is limited,falseif notcommunityBanned-trueif your account is banned from Steam Community,falseif notlocked-trueif your account is locked,falseif not (accounts can also be locked by Support)canInviteFriends-trueif your account can invite friends,falseif not
An object containing information about your account's VAC bans. null until vacBans is emitted.
numBans- How many bans are registered on your accountappids- An array of AppIDs from which you're banned. Since each ban affects a range of AppIDs, some of the AppIDs in this array may not exist.
An object containing information about your Steam Wallet. null until wallet is emitted.
hasWallet-trueif your account has a Steam Wallet,falseif notcurrency- The currency ID of your account's wallet (the enum of currencies is available asSteamUser.ECurrencyCode)balance- Your account's current wallet balance
An array containing license data for the packages which your Steam account owns. null until licenses is emitted.
An object containing persona data about all Steam users we've encountered or requested data for. Key are 64-bit SteamIDs, values are identical to the objects received in the user event.
An object containing information about all Steam groups we've encountered. Keys are 64-bit SteamIDs, values are identical to those received in the group event.
An object containing information about all chat rooms we're in. Keys are 64-bit SteamIDs, values are objects with this structure:
name- The name of the chat, or empty if it's a multi-user chatprivate-trueif only group members can join,falseif it's open to everyoneinvisibleToFriends-trueif the chat is invisible to friends,falseif visible (unsure what this means at this time)officersOnlyChat-trueif only group officers can chat right now,falseif everyone canunjoinable-trueif the chat can't be joined,falseif it can (note that this doesn't necessary mean your effective access)members- An object whose keys are 64-bit SteamIDs of users in this chat room, and whose values are objects with this structure:rank- A value fromEClanRankpermissions- A bitstring of values inEChatPermissionfor the user's permissions in this chat
An object whose keys are 64-bit SteamIDs, and whose values are values from the EFriendRelationship enum. Therefore, you can deduce your friends list from this object.
When we get unfriended, instead of setting the value to EFriendRelationship.None, the key is deleted from the object entirely.
An object whose keys are 64-bit SteamIDs, and whose values are from the EFriendRelationship enum. Therefore, you can deduce which groups you're in from this object.
When we leave a group, instead of setting the value to EFriendRelationship.None, the key is deleted from the object entirely.
v1.10.0 or later is required to use this property
An object containing your friend groups (in the official client, these are called tags). Keys are numeric group IDs, and objects as follows:
name- Astringcontaining the name of the group.members- An array containingSteamIDobjects for the members of this friend group.
v3.3.0 or later is required to use this property
An object containing cached data about known apps and packages. Only useful if the enablePicsCache option is true.
changenumber- The last known changenumberapps- An object whose keys are AppIDs and values are objects identical to those returned bygetProductInfopackages- An object whose keys are PackageIDs and values are objects identical to those returned bygetProductInfo
client- An optionalSteamClientto use to connect to Steam. If not provided, one will be created automatically.options- An optional object containing zero or more options to set for thisSteamUser.
Constructs a new SteamUser. If you allow SteamUser to create its own SteamClient, then SteamUser will
automatically save and reload the CM server list.
option- The name of the option to setvalue- The value to set for this option
Changes the value of an option.
options- An object containing zero or more options.
sentry- A Buffer containing the binary sentry file, binary SHA1 hash, ornullto unset the set sentry
If you aren't using dataDirectory or you just want to provide your own sentry file, you can do it using this method.
You should call this before calling logOn. When you log on, SteamUser will use this sentry file.
You can provide either an entire sentryfile (preferred), or a Buffer containing the binary SHA1 hash of your sentryfile
(e.g. the output of the sentry event in node-steam 0.6.x).
details- An object containing details for this logonaccountName- If logging into a user account, the account's namepassword- If logging into an account without a login key, the account's passwordauthCode- If you have a Steam Guard email code, you can provide it here. You might not need to, see thesteamGuardevent. (Added in 1.9.0)twoFactorCode- If you have a Steam Guard mobile two-factor authentication code, you can provide it here. You might not need to, see thesteamGuardevent. (Added in 1.9.0)loginKey- If logging into an account with a login key, this is the account's login keyrememberPassword-trueif you want to get a login key which can be used in lieu of a password for subsequent logins.falseor omitted otherwise.logonID- A number to identify this login. The official Steam client derives this from your machine's private IP (it's theobfustucated_private_ipfield inCMsgClientLogOn). If you try to logon twice to the same account from the same public IP with the samelogonID, the first session will be kicked with reasonSteam.EResult.LogonSessionReplaced. Defaults to0if not specified.
Logs onto Steam. The CMClient/SteamClient should not be already logged on, although as of v3.4.0 it can be
connected. Omit the details object if you wish to login to an anonymous user account.
Logs you off of Steam and closes the connection.
SteamUser will automatically log onto steamcommunity.com when a successful connection to Steam is established (as an
individual user), but you can call webLogOn() to create a new session if your old one expires or becomes invalid.
Listen for the webSession event to get your cookies.
accountName- The username of your new accountpassword- The password for your new accountemail- The contact email for your new accountcallback- Called when the account is either created or an error occursresult- A value fromSteam.EResult.Steam.EResult.OKif the account was created successfullySteam.EResult.DuplicateNameif there is already an account with that usernameSteam.EResult.IllegalPasswordif your password is too weak or otherwise bad- or something else on another error
steamid- If successful, this is aSteamIDobject containing the new account's SteamID
Creates a new individual user Steam account. You must be logged on either anonymously or as an existing individual user to use this.
callback- Optional. Called when a response is availableresult- A value fromSteam.EResult.Steam.EResult.OKif the mail was sent successfully.
Requests Steam to send you a validation email to your registered email address.
callback- Required. Called when the activation email has been sent.response- An object containing the response data
v2.0.0 or later is required to use this method
Starts the process to turn on TOTP for your account. You must have a phone number already linked with and verified on your account.
You'll be sent an SMS with an activation code that you'll need to provide to finalizeTwoFactor.
You should save the entire response object somewhere secure. You can use JSON.stringify on it safely.
Properties of note in the response object:
status- A value fromEResult. If this is notOK(1), then the request failed.shared_secret- This is your secret that's used for two-factor authentication.revocation_code- You will need this in the future to disable two-factor authentication.
secret- ABuffercontaining your shared secretactivationCode- Astringcontaining the activation code you got in your SMScallback- Required.err- AnErrorobject on failure, ornullon success
v2.0.0 or later is required to use this method
Finishes the process of enabling TOTP two-factor authentication for your account. You can use steam-totp in the future when logging on to get a code.
If TOTP two-factor authentication is enabled, a code will be required on every login unless a loginKey is used.
This method no longer works. Attempts to call it will result in an Error being thrown. Use node-steamcommunity instead.
callback- A function to be called when the requested data is availableenabled-trueif Steam Guard is enabled for your account,falseif notenabledTime- ADateobject representing when Steam Guard was enabled for your account, ornullif not availablemachineTime- ADateobject representing when your current machine was authorized with Steam Guard, ornullif not availablecanTrade-trueif Steam Guard will allow you to trade,falseif not. You may still be blocked by a trade ban or another trading limitation.twofactorTime- ADateobject representing when the Steam Guard Mobile Authenticator was enabled for your account, ornullif not enabled
v1.11.0 or later is required to use this method. v1.12.0 or later is required to use canTrade. v3.3.3 or later is required to use twofactorTime.
Requests details about your account's Steam Guard status. This could be used to see if your account passes the Steam Guard trading requirements.
In order to trade, all of the following must be true:
enabledmust betrue(account-level restriction)enabledTimemust be at least 15 days ago (account-level restriction)- ONE of
machineTimeORtwofactorTimemust be at least 7 days ago (sentryfile-level restriction)
apps - An array, object, string, or number (see below)
Reports to Steam that you're playing or using zero or more games/apps. To exit all games/apps, use an empty array [].
To play a single game by AppID, use a single integer (e.g. 440)
To play a single non-Steam game by name, use a single string (e.g. "Minecraft")
To play a single game by AppID and name (the client-provided name is what is given to the WebAPI and mobile app), use an object of this format:
{
"game_id": 440,
"game_extra_info": "Team Fortress 2"
}You can use multiple apps by providing an array of any mixture of the above formats.
appid- The AppID of the app for which you'd like the current player/user count (use0to get current logged-in Steam user count)callback- Called when the requested data is availableresult- A value fromSteam.EResultplayers- How many Steam users are currently playing/using the app
Requests a count of how many Steam users are currently playing/using an app.
conditions- A filter string or an object containing one or more of the following properties:app_id- The AppID of the game for which you want serversgeo_location_ip- The IP address of the querying client, used for geolocation (inx.x.x.xformat)region_code- The region code where you want serversfilter_text- A filter stringmax_servers- Maximum number of servers to return in this response (default and hard limit 5000)
callback- Called when the response is availableerr- If an error occurred, this is anErrorobject. Otherwise, it'snull.servers- An array of objects containing server dataip- The server's IP inx.x.x.xformatport- The server's game portplayers- How many authenticated players are on this server (the Steam server browser will use this value if the gameserver itself reports more players and doesn't report itself as full, to prevent inflated player counts)
Requests a list of game servers from the master server.
filter- A master server filter stringlimit- How many servers should be returned, at maximum. Hard limit is 5000.callback- Called when the requested data is availableservers- An array of objects containing server dataaddr- The server's IP address inx.x.x.x:pformatgameport- The port the server is running on for game clientsspecport- The port the server is running on for spectator clients (nullfor none)steamid- ASteamIDobject containing the server's SteamIDname- The server's hostnameappid- The AppID of the game which the server is servinggamedir- The directory of the game which the server is servingversion- The version of the game which the server is servingproduct- The product name of the game which the server is servingregion- The region code for where the server is locatedplayers- How many people are currently on this servermax_players- How many people can be on the server at oncebots- How many CPU players are currently on this servermap- The name of the map which the server is currently runningsecure-trueif the server is VAC-secure,falseif notdedicated-trueif the server is dedicated,falseif listenos-wif the server is running on Windows,lfor Linuxgametype- The server's tags, separated by commas
Works when anonymous. Requests a list gameservers from Steam matching a given filter, along with information about the server as Steam knows it.
ips- An array of IP addresses, inx.x.x.x:pformatcallback- Called when requested data is availableservers- An object whose keys are IP addresses inx.x.x.x:pformat and values areSteamIDobjects
Works when anonymous. Gets current SteamIDs for servers running on given addresses.
steamids- An array ofSteamIDobjects, or something which can parse into one (64-bit SteamID as string, Steam3 rendered format)callback- Called when requested data is availableservers- An object whose keys are 64-bit numeric SteamIDs and values are IP addresses inx.x.x.x:pformat
Works when anonymous. Gets current IP addresses for servers with given SteamIDs.
sinceChangenumber- The changenumber of the last known changelist. You will get changes which have occurred since then and now. Use 1 to request all changes ever.callback- Called when data is availablecurrentChangenumber- The changenumber of the newest changelistapps- An array of objects for apps which have changed. Each object has these properties:appid- The AppID of the appchange_number- The changenumber of the latest changelist in which the app has changedneeds_token-trueif you need an access token to get most details about this app,nullif not
packages- An array of objects for packages which have changed. Each object has the same properties as theappsarray, exceptappidispackageid.
Works when anonymous. Requests a list of all apps/packages which have changed since a given changenumber.
apps- Either an array of AppIDs, or an array of objects containingappidandaccess_tokenpropertiespackages- Either an array of PackageIDs, or an array of objects containingpackageidandaccess_tokenpropertiescallback- Called when requested data is availableapps- An object whose keys are AppIDs and whose values are objectschangenumber- The changenumber of the latest changelist in which this app changedmissingToken-trueif you need to provide an access token to get more details about this appappinfo- An object whose structure is identical to the output ofapp_info_printin the Steam console
packages- An object whose keys are PackageIDs and whose values are objects. Each object has the same properties as theappsarray, exceptappinfoispackageinfo.unknownApps- An array of input AppIDs which don't existunknownPackages- An array of input PackageIDs which don't exist
Works when anonymous. Requests details about one or more apps or packages.
apps- An array of AppIDspackages- An array of PackageIDscallback- Called when requested data is availableapps- An object whose keys are AppIDs and whose values are access tokenspackages- An object whose keys are PackageIDs and whose values are access tokensappDeniedTokens- An array of AppIDs for which Steam denied you an access tokenpackageDeniedTokens- An array of PackageIDs for which Steam denied you an access token
Works when anonymous. Requests access tokens for one or more apps or packages. These access tokens can be used with getProductInfo.
Access tokens are global. That is, everyone who has access to an app receives the same token. Tokens do not seem to expire.
v3.3.0 or later is required to use this method
Returns an array of AppIDs which your account owns. This cannot be safely called until appOwnershipCached is emitted.
enablePicsCache must be true to use this method. Otherwise, an Error will be thrown.
appid- A numeric AppID
v3.3.0 or later is required to use this method
Returns true if your account owns the specified AppID, or false if not. This cannot be safely called until
appOwnershipCached is emitted.
enablePicsCache must be true to use this method. Otherwise, an Error will be thrown.
v3.3.0 or later is required to use this method
Returns an array of depot IDs which your account owns. This cannot be safely called until appOwnershipCached is emitted.
enablePicsCache must be true to use this method. Otherwise, an Error will be thrown.
depotid- A numeric depot ID
v3.3.0 or later is required to use this method
Returns true if your account owns the specified depot, or false if not. This cannot be safely called until
appOwnershipCached is emitted.
enablePicsCache must be true to use this method. Otherwise, an Error will be thrown.
v3.3.0 or later is required to use this method
Returns an array of package IDs which your account owns. If you logged in anonymously, this can be safely called
immediately following logon. Otherwise, this cannot be safely called until licenses is emitted.
packageid- A numeric package ID
v3.3.0 or later is required to use this method
Returns true if your account owns the specified package ID, or false if not. If you logged in anonymously, this can
be safely called immediately following logon. Otherwise, this cannot be safely called until licenses is emitted.
state- A value fromEPersonaStatename- Optional. Your new profile name
v1.9.0 or later is required to use this method
Changes our online status, and optionally your profile name. You need to call this after you logon or else you'll show up as offline.
steamID- The SteamID of the user you want to add as a friend, as aSteamIDobject or a string that can parse into one
v1.9.0 or later is required to use this method
Sends a friend request to the user with the specified SteamID. If they've already sent you a friend request, accepts it.
steamID- The SteamID of the user you want to remove from your friends list, as aSteamIDobject or a string that can parse into one
v1.9.0 or later is required to use this method
Removed a specified user from your friends list. Also ignores an outstanding friend request from this user.
steamID- The SteamID of the user you want to block, as aSteamIDobject or a string that can parse into onecallback- Optional. Called when the request completeseresult- A value from theEResultenum
v1.9.0 or later is required to use this method
Blocks all communication with a specified user.
steamID- The SteamID of the user you want to unblock, as aSteamIDobject or a string that can parse into onecallback- Optional. Called when the request completeseresult- A value from theEResultenum
v1.9.0 or later is required to use this method
Unblocks all communication with a specified user.
steamids- An array ofSteamIDobjects or strings which can parse intoSteamIDobjectscallback- Optional. Called when the requested data is available.personas- An object whose keys are 64-bit SteamIDs and whose values are objects identical to those received in theuserevent
v1.9.0 or later is required to use this method
Requests persona data for one or more users from Steam. The response will arrive in the user event, or in the callback if provided.
steamids- An array ofSteamIDobjects or strings that can parse intoSteamIDobjectscallback- Called when the requested data is available.results- An object whose keys are 64-bit SteamIDs (as strings) and whose values are Steam levels
v1.9.0 or later is required to use this method
Gets the Steam Level for one or more Steam users (who do not have to be on your friends list).
steamID- Either aSteamIDobject or a string which can parse into one
v1.9.0 or later is required to use this method
Send a trade request to the specified user. Listen for the tradeResponse event for their response.
steamID- Either aSteamIDobject or a string which can parse into one
v1.9.0 or later is required to use this method
Cancels your outstanding trade request to the specified user.
recipient- Either aSteamIDobject or a string which can parse into one for the recipient of your messagemessage- The chat message that you're sending to themtype- Optional. A value fromEChatEntryType. Defaults toChatMsg. This usually shouldn't be needed.
v1.9.0 or later is required to use this method
Sends a chat message to a friend or a chat room.
recipient- Either aSteamIDobject or a string which can parse into one
v1.9.0 or later is required to use this method
Tells the recipient that you're typing a chat message.
steamID- Either aSteamIDobject or a string which can parse into onecallback- Optional. Called when the requested data is availablesuccess- AnEResultvaluemessages- An array of message objects, each of which has the following properties:steamID- The SteamID of the user who sent the message, either us or them (as aSteamIDobject)timestamp- ADateobject for when the message was sentmessage- The message textunread-trueif this was a new offline message,falseif it's just history
v1.9.0 or later is required to use this method
Requests our chat history with a user. The results will arrive either in the callback or in the chatHistory event.
steamID- The SteamID of the chat to join (as aSteamIDobject or a string which can parse into one)callback- Optional. Called when we either join or fail to join.result- A value fromEResult
v1.9.0 or later is required to use this method
Joins a chat room. To join a group chat, use the group's SteamID.
steamID- The SteamID of the chat room to leave (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Leaves a chat room we're in.
steamID- The SteamID of the chat room to lock (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Locks a chat room so that only group members and invited users can join.
steamID- The SteamID of the chat room to unlock (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Unlocks a chat room so anyone can join.
steamID- The SteamID of the chat room to set officers-only (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Sets a chat room so that only group officers can chat.
steamID- The SteamID of the chat room to unset officers-only (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Sets a chat room so that anyone can chat.
chatID- The SteamID of the chat room to kick the user from (as aSteamIDobject or a string which can parse into one)userID- The SteamID of the user to kick from the room (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Kicks a user from a chat room.
chatID- The SteamID of the chat room to ban the user from (as aSteamIDobject or a string which can parse into one)userID- The SteamID of the user to ban from the room (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Bans a user from a chat room.
chatID- The SteamID of the chat room to unban the user from (as aSteamIDobject or a string which can parse into one)userID- The SteamID of the user to unban from the room (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Unbans a banned user from a chat room.
chatID- The SteamID of the chat room to invite to (as aSteamIDobject or a string which can parse into one)userID- The SteamID of the user to invite to the room (as aSteamIDobject or a string which can parse into one)
v1.9.0 or later is required to use this method
Invites a user to a chat room.
convertUserID- If the user with the SteamID passed here has a chat window open with us, their window will be converted to the new chat room and they'll join it automatically. If they don't have a window open, they'll get an invite.inviteUserID- If specified, the user with the SteamID passed here will get invited to the new room automatically.callback- Optional. Called when the chat is created or a failure occurs.result- A value fromEResultchatID- If successful, the SteamID of the newly-created room, as aSteamIDobject
v1.9.0 or later is required to use this method
Creates a new multi-user chat room.
key- Steam formatted game keycallback- Optional. Called when request completesresult- AnEResultvaluedetails- ASteamUser.EPurchaseResultvaluepackages- An object whose keys are packageIDs and values are package names
Redeems game code on your account
Events marked as ID events are special. They all have a SteamID object as their first parameter. In addition to the event itself firing, a second event comprised of eventName + "#" + steamID.getSteamID64() is fired.
For example:
// This will fire when we receive a chat message from ANY friend
user.on('friendMessage', function(steamID, message) {
console.log("Friend message from " + steamID.getSteam3RenderedID() + ": " + message);
}
// This will fire when we receive a chat message from [U:1:46143802] / 76561198006409530 ONLY
user.on('friendMessage#76561198006409530', function(steamID, message) {
console.log("Friend message from " + steamID.getSteam3RenderedID() + ": " + message);
}details- An object containing various details about your account (seeCMsgClientLogonResponse)
Emitted when you're successfully logged into Steam.
domain- If an email code is needed, the domain name of the address where the email was sent.nullif an app code is needed.callback- Should be called when the code is available.code- The Steam Guard auth code
lastCodeWrong-trueif you're using 2FA and the last code you provided was wrong,falseotherwise
If the promptSteamGuardCode option is disabled, this event will be emitted when Steam requests a Steam Guard code from us. You should collect the code from the user somehow and then call the callback with the code as the sole argument.
Example:
user.on('steamGuard', function(domain, callback) {
console.log("Steam Guard code needed from email ending in " + domain);
var code = getCodeSomehow();
callback(code);
});err- AnErrorobject
Emitted when an error occurs during logon. Also emitted if we're disconnected and autoRelogin is either disabled, or it's a fatal disconnect.
If this event isn't handled, the program will crash.
The SteamUser object's steamID property will still be defined when this is emitted. The Error object will have an eresult parameter which is a value from the EResult enum.
eresult- A value from theSteam.EResultenum
Emitted when we're disconnected from Steam for a non-fatal reason and autoRelogin is enabled. SteamUser will
continually retry connection and will either emit loggedOn when logged back on, or error if a fatal logon error is
experienced.
Also emitted in response to a logOff() call.
The SteamUser object's steamID property will still be defined when this is emitted.
sentry- A Buffer containing your new sentry file
Emitted when Steam sends us a new sentry file. By default, SteamUser will automatically save and reuse this sentry file for subsequent logins, but if you wish you may handle it yourself (see setSentry).
sessionID- The value of thesessionidcookiecookies- An array of cookies, asname=valuestrings
Emitted when a steamcommunity.com web session is successfully negotiated. This will automatically be emitted on logon and in response to webLogOn calls.
Some libraries require you to provide your sessionID, others don't. If your library doesn't, you can safely ignore it.
key- Your login key
If you enabled rememberPassword in logOn, this will be emitted when Steam sends us a new login key. This key can be passed to logOn as loginKey in lieu of a password on subsequent logins.
At this time, I'm not sure if login keys expire, so to be safe you should record this somewhere (in a database, in a file, etc) and overwrite it every time the event is emitted.
count- How many new items you have (can be 0)
Emitted when Steam sends a notification of new items. You can reset the count to 0 by loading your inventory page (https://steamcommunity.com/my/inventory) while logged in.
count- How many total new comments you have (can be 0)myItems- How many of the total comments are on your content (workshop items, screenshots, your profile, etc.)discussions- How many of the total comments are posts in subscribed discussion threads
Emitted when Steam sends a notification of new comments.
count- How many active received trade offers you have (can be 0)
Emitted when Steam sends a notification of new trade offers.
count- How many unread offline chat messages you havefriends- An array of SteamID strings for the users who have sent you unread offline chat messages
Emitted when Steam sends a notification of unread offline chat messages. This will always be emitted after logon, even if you have no messages.
name- Your account's Steam (persona) namecountry- The character code from which you're logging in (via GeoIP), e.g. "US"authedMachines- How many machines are authorized to login to your account with Steam Guardflags- Your account's bitwise flagsfacebookID- If your account is linked with Facebook, this is your Facebook account IDfacebookName- If your account is linked with Facebook, this is your (real) name on Facebook
v3.4.0 or later is required to use this event
Emitted on logon and when account info changes. This event is emitted before the accountInfo property is updated, so you can compare to see what changed.
address- Your account's email addressvalidated- A boolean value for whether or not your email address is validated
Emitted on logon and when email info changes. The emailInfo property will be updated after this event is emitted.
limited-trueif your account is limited,falseif notcommunityBanned-trueif your account is banned from Steam Community,falseif notlocked-trueif your account is locked,falseif not (accounts can also be locked by Support)canInviteFriends-trueif your account can invite friends,falseif not
Emitted on logon and probably when limitations change. The limitations property will be updated after this event is emitted.
numBans- How many bans your account hasappids- The AppIDs from which you're banned. Since each ban affects a range of AppIDs, some of the AppIDs in this array may not exist.
Emitted on logon and probably when you get banned/unbanned. The vac property will be updated after this event is emitted.
hasWallet-trueif your account has a Steam Wallet,falseif notcurrency- The currency ID of your account's wallet (the enum of currencies is available asSteamUser.ECurrencyCode)balance- Your account's current wallet balance
Emitted on logon and when wallet balance changes. The wallet property will be updated after this event is emitted.
licenses- An array of licenses
Contains the license data for the packages which your Steam account owns. To see license object structure, see
CMsgClientLicenseList.License.
Emitted on logon and when licenses change. The licenses property will be updated after this event is
emitted.
This isn't emitted for anonymous accounts. However, all anonymous user accounts have a license for package 17906 automatically.
v3.3.0 or later is required to use this event
Emitted once we have all data required in order to determine app ownership. You can now safely call getOwnedApps,
ownsApp, getOwnedDepots, and ownsDepot.
This is only emitted if enablePicsCache is true.
changenumber- The changenumber of the changelist we just receivedapps- An array of AppIDs which changed since our last received changelistpackages- An array of PackageIDs which changed since our last received changelist
v3.3.0 or later is required to use this event
Emitted when we receive a new changelist from Steam. The picsCache property is updated after this is emitted, so you
can get the previous changenumber via picsCache.changenumber.
This is only emitted if enablePicsCache is true and changelistUpdateInterval is nonzero.
appid- The AppID of the app which just changeddata- An object identical to that received fromgetProductInfo
v3.3.0 or later is required to use this event
Emitted when an app that was already in our cache updates. The picsCache property is updated after this is emitted, so
you can get the previous app data via picsCache.apps[appid].
This is only emitted if enablePicsCache is true and changelistUpdateInterval is nonzero.
packageid- The PackageID of the package which just changeddata- An object identical to that received fromgetProductInfo
v3.3.0 or later is required to use this event
Emitted when a package that was already in our cache updates. The picsCache property is updated after this is emitted,
so you can get the previous package data via picsCache.packages[packageid].
This is only emitted if enablePicsCache is true and changelistUpdateInterval is nonzero.
timestamp- ADateobject containing the time when this batch of messages was publishedmessages- An array of objects containing the following propertiesid- The marketing message's 64-bit numeric ID, as a stringurl- The URL where you can view this messageflags- A 32-bit integer containing the message's bitwise flags
v3.4.0 or later is required to use this event
Emitted on logon, and when new marketing messages are published. Marketing messages are the popups that appear after you exit a game if you have "Notify me about additions or changes to my games, new releases, and upcoming releases" enabled in the Steam client.
steamID- The SteamID of the user who sent the request, as aSteamIDobjectrespond- A function which you should call to either accept or decline the requestaccept-trueto accept the request,falseto decline it
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when someone sends us a trade request. Example usage:
user.on('tradeRequest', function(steamID, respond) {
console.log("Incoming trade request from " + steamID.getSteam3RenderedID() + ", accepting");
respond(true);
}steamID- The SteamID of the other user, as aSteamIDobjectresponse- A value from theEEconTradeResponseenumrestrictions- An object containing the following properties (of which any or all could be undefined)steamguardRequiredDaysnewDeviceCooldownDaysdefaultPasswordResetProbationDayspasswordResetProbationDaysdefaultEmailChangeProbationDaysemailChangeProbationDays
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when someone responds to our trade request. Also emitted with response EEconTradeResponse.Cancel when someone cancels their outstanding trade request to us.
steamID- The SteamID of your trade partner, as aSteamIDobject
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a new trade session has started (either as a result of someone accepting a Steam trade request, an in-game (TF2) trade request, or something else).
The trade is now available at http://steamcommunity.com/trade/[SteamID], and can be automated with node-steam-trade.
sid- ASteamIDobject for the user whose data we just receiveduser- An object containing the user's persona data
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when Steam sends us persona information about a user. The users property isn't yet updated when this is emitted, so you can compare to see what changed.
sid- ASteamIDobject for the group whose data we just receivedgroup- An object containing the group's data
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when Steam sends us information about a Steam group. The groups property isn't yet updated when this is emitted, so you can compare to see what changed.
sid- ASteamIDobject for the group who just posted/started an eventheadline- The name of the eventdate- ADateobject for the event's start timegid- The event's GID (link to the event page at https://steamcommunity.com/gid//event/)gameID- The AppID of the game which this event is associated with
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a group schedules a new event, or a new event starts.
sid- ASteamIDobject for the group who just posted an announcementheadline- The title of the announcementgid- The announcement's GID (link to the announcement page at https://steamcommunity.com/gid//announcements/detail/)
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a group posts a new announcement.
sid- ASteamIDobject for the user whose relationship with us just changedrelationship- A value fromEFriendRelationship
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when our relationship with a particular user changes. For example, EFriendRelationship.RequestRecipient means that we got invited as a friend, EFriendRelationship.None means that we got unfriended.
The myFriends property isn't yet updated when this is emitted, so you can compare to the old value to see what changed.
sid- ASteamIDobject for the group whose relationship with us just changedrelationship- A value fromEFriendRelationship
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when our relationship with a particular Steam group changes.
The myGroups property isn't yet updated when this is emitted, so you can compare to the old value to see what changed.
v1.9.0 or later is required to use this event
Emitted when our friends list is downloaded from Steam after logon.
v1.9.0 or later is required to use this event
Emitted when our group list is downloaded from Steam after logon.
groups- An object whose structure is identical to themyFriendGroupsproperty
v1.10.0 or later is required to use this event
Emitted when our friends group list is downloaded from Steam after logon (in the official client, these are called tags).
The myFriendGroups property will be updated after this event is emitted, so you can compare groups with the property to see what changed.
senderID- The message sender, as aSteamIDobjectmessage- The message textroom- The room to which the message was sent. This is the user'sSteamIDif it was a friend message
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when we receive either a friend message or a chat room message.
senderID- The message sender, as aSteamIDobjectmessage- The message text
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when we receive a direct friend message (that is, not through a chat room).
senderID- TheSteamIDof the friend who's typing
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when Steam notifies us that one of our friends is typing a message to us.
recipientID- TheSteamIDof the user who rececived this messagemessage- The message text
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when Steam echos us a message that we sent to a friend on another login.
recipientID- TheSteamIDof the user who we're typing to
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when Steam echos us a notification that we're typing to a friend on another login.
room- TheSteamIDof the chat roomchatter- TheSteamIDof the message sendermessage- The message text
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when we receive a chat message from a chat room. This is a special ID event. Any of the following are acceptable:
chatMessagechatMessage#roomIDchatMessage#senderIDchatMessage#roomID#senderID
steamID- TheSteamIDof the user with whom we got chat historysuccess- AnEResultvaluemessages- An array of message objects
v1.9.0 or later is required to use this event
This is an ID event.
With the exception of the steamID argument, this is identical to the callback of getChatHistory.
inviterID- TheSteamIDof the user who invited uschatID- TheSteamIDof the chat that we were invited tochatName- The name of the chat we were invited to. Empty if it's a multi-user chat and not a group chat.
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when we're invited to join a chat room. This is a special ID event. Any of the following are acceptable:
chatInvitechatInvite#inviterIDchatInvite#chatIDchatInvite#inviterID#chatID
friendID- TheSteamIDof the friend with whom we were creating this roomeresult- AnEResultvaluechatID- TheSteamIDof the newly-created chat, if successful
v1.9.0 or later is required to use this event
This is an ID event.
With the exception of the friendID argument, this event is identical to the callback of createChatRoom.
chatID- TheSteamIDof the chat room that we either entered or failed to enterresponse- A value fromEChatRoomEnterResponse
v1.9.0 or later is required to use this event
This is an ID event.
With the exception of the chatID argument, this event is identical to the callback of joinChat.
chatID- TheSteamIDof the chat room that we left
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when we leave a chat room for any reason (we left, kicked, banned, etc).
chatID- TheSteamIDof the chat room that the user joineduserID- TheSteamIDof the user who joined
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a user joins a chat room we're in.
chatID- TheSteamIDof the chat room that the user leftuserID- TheSteamIDof the user who left
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a user leaves a chat room we're in.
chatID- TheSteamIDof the chat room that the user disconnected fromuserID- TheSteamIDof the user who disconnected
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a user in a chat room we're in disconnects from Steam.
chatID- TheSteamIDof the chat room that the user was kicked fromuserID- TheSteamIDof the user who was kickedactor- TheSteamIDof the user who did the kicking
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a user is kicked from a chat room we're in.
chatID- TheSteamIDof the chat room that the user was banned fromuserID- TheSteamIDof the user who was bannedactor- TheSteamIDof the user who did the banning
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a user is banned from a chat room we're in.
chatID- TheSteamIDof the chat room that the user is speaking inuserID- TheSteamIDof the user who is speaking
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a user in a chat room we're in starts speaking over voice chat.
chatID- TheSteamIDof the chat room that the user is done speaking inuserID- TheSteamIDof the user who is done speaking
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a user in a chat room we're in stops speaking over voice chat.
chatID- TheSteamIDof the chat room that was unlockedactor- TheSteamIDof the user who unlocked it
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a chat room we're in is unlocked so that anyone can join.
chatID- TheSteamIDof the chat room that was lockedactor- TheSteamIDof the user who locked it
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a chat room we're in is locked so that only group members can join without an invite.
chatID- TheSteamIDof the chat room that was set officers-onlyactor- TheSteamIDof the user who set it officers-only
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a chat room we're in is set so that only group officers can chat.
chatID- TheSteamIDof the chat room that was unset officers-onlyactor- TheSteamIDof the user who unset it officers-only
v1.9.0 or later is required to use this event
This is an ID event.
Emitted when a chat room we're in is set so that everyone can chat.