Table of Contents
- Non-Object Methods
- Properties
- Methods
- getAvatarURL([size, protocol])
- addFriend([callback])
- acceptFriendRequest([callback])
- removeFriend([callback])
- blockCommunication([callback])
- unblockCommunication([callback])
- comment(message[, callback])
- inviteToGroup(groupID[, callback])
- getInventoryContexts(callback)
- getInventory(appID, contextID, tradableOnly, callback)
- getInventoryContents(appID, contextID, tradableOnly, language, callback)
- getAliases(callback)
- getProfileBackground(callback)
- sendImage(imageContentsBuffer[, options], callback)
- getComments([options, ]callback)
- deleteComment(commentID[, callback])
- follow([callback])
- unfollow([callback])
A class which stands for a Steam user. This class cannot be instantiated directly; it must be received from a call to getSteamUser.
Non-Object Methods
As of v3.7.0, if you don't want to bother with setting up a CSteamUser object, methods on this page marked with a non-object method name can be called directly on your SteamCommunity instance, with the user's SteamID (as a SteamID object or a string which can be parsed into one) being the first parameter. For example:
var SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();
community.getUserComments("[U:1:46143802]", function(err, comments, totalCount) {
/* do something... */
});
Properties
steamID
A SteamID object containing the user's SteamID. Visit a user's profile at https://steamcommunity.com/profiles/SteamID
name
The user's current profile name (can be changed).
onlineState
The user's current online state. One of in-game, online, or offline.
stateMessage
A message describing the user's current online state. Displayed on the profile below their status.
privacyState
One of public, friendsonly, private. May also be a legacy value like friendsfriendsonly, these should be treated as private.
visibilityState
The user's visibility state relative to you, as an integer. 1 if visible, 0 if private. If privateState is a legacy value, this will be 1 although it should in effect be 0.
avatarHash
The hash of the user's avatar.
vacBanned
true if the user has one or more VAC bans on record, false otherwise.
tradeBanState
One of None, Probation, or Banned.
isLimitedAccount
true if the user's account is limited, false otherwise.
customURL
The user's custom vanity URL.
memberSince
A Date object for the user's account creation date (unavailable and null if private)
location
The user's given location (unavailable and null if private or not provided)
realName
The user's given real name (unavailable and null if private or not provided)
summary
The user's profile summary (unavailable and null if private)
groups
An array of SteamID objects for the user's joined groups.
primaryGroup
A SteamID object for the user's chosen primary group.
Methods
getAvatarURL([size, protocol])
size- Optional. One ofsmall(default),medium,fullprotocol- Optional. One ofhttp://(default),https://,//(protocol aware)
Returns a URL where you can download this user's avatar image.
addFriend([callback])
callback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: addFriend
Adds the user as a friend.
acceptFriendRequest([callback])
callback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: acceptFriendRequest
Accepts a pending friend request from this user.
removeFriend([callback])
callback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: removeFriend
Removes the user from your friends list.
blockCommunication([callback])
callback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: blockCommunication
Blocks all communication with the user.
unblockCommunication([callback])
callback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: unblockCommunication
Removes the user from your blocked list.
comment(message[, callback])
message- The message to leave on the user's profilecallback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: postUserComment
Attempts to post a comment on the user's profile. Fails if profile is private or you don't have permission to post comments on the user's profile.
inviteToGroup(groupID[, callback])
groupID- The SteamID of the group, as aSteamIDobject or a string which can be parsed into onecallback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: inviteUserToGroup
v3.7.0 or later is required to use this method.
Attempts to invite the user to a Steam group. Fails if you're not friends with them.
Use this in accordance with the Steam Subscriber Agreement and don't send unsolicited group invites.
getInventoryContexts(callback)
callback- Required. Called when the requested data is available.err-nullon success, anErrorobject on failureapps- An object whose keys are AppIDs and values are objects containing app and context data
Non-object method name: getUserInventoryContexts
v3.8.0 or later is required to use this method.
Gets info about what inventories are available to a user. Calling this for your own logged-in account will reset the number of new items you have to 0.
getInventory(appID, contextID, tradableOnly, callback)
appID- The AppID of the app which owns the inventory you want to retrievecontextID- The ContextID of the context within the app you want to loadtradableOnly-trueto only get tradable items,falseto get allcallback- Required. Called when requested data is available.
Non-object method name: getUserInventory
v3.8.0 or later is required to use this method. THIS METHOD IS DEPRECATED AS OF v3.30.0.
Gets the contents of a user's inventory.
This method is deprecated and will be removed in the future. Use getInventoryContents instead.
getInventoryContents(appID, contextID, tradableOnly, language, callback)
appID- The AppID of the app which owns the inventory you want to retrievecontextID- The ContextID of the context within the app you want to loadtradableOnly-trueto only get tradable items,falseto get alllanguage- Optional. The full name of the language you want to get descriptions in, e.g.englishorspanishorschinese. Omit for default, which is either English or your Steam language (not sure which)callback- Required. Called when requested data is available.err-nullon success, anErrorobject on failureinventory- An array containingCEconItemobjects for the user's inventory itemscurrency- An array containingCEconItemobjects for the user's currency items (only used by Spiral Knights to the extent of my knowledge)totalItems- A number containing the total number of items in this contextid
Non-object method name: getUserInventoryContents
v3.30.0 or later is required to use this method.
v3.31.0 or later is required to use the language argument.
Gets the contents of a user's inventory. This method uses the newer /inventory/SteamID endpoint, which is less rate-limited than the older, deprecated /profiles/SteamID/inventory/json endpoint. However, the output data is slightly different. The only known difference right now is that app_data is not available. You will need to use other means to obtain that data if you need it. Don't rely on the older endpoint and the deprecated getInventory method as it will likely be removed in the future.
getAliases(callback)
callback- Required. Called when requested data is available.err-nullon success, anErrorobject on failurealiases- An array of objects for each of the user's 10 most recent name changes (including the current name) containing the following properties:newname- A string containing the user's new nametimechanged- ADateobject for when they adopted this name
Non-object method name: getUserAliases
v3.22.0 or later is required to use this method.
Gets a user's persona name history.
getProfileBackground(callback)
callback- Required. Called when requested data is available.err-nullon success, anErrorobject on failurebackgroundUrl- A string containing the user's profile background URL.nullif they have no custom background.
Non-object method name: getUserProfileBackground
v3.37.0 or later is required to use this method.
Gets the URL to the custom profile background for a user. If they have no custom background set, the URL is returned as null. If their profile is private, an error will be returned informing you of this.
sendImage(imageContentsBuffer[, options], callback)
imageContentsBuffer- The content of the image you wish to send, as aBufferoptions- Optional. An object with zero or more of these properties:spoiler- true to mark this as a spoiler (default false)
callback- Required. Called when the request completeserr-nullon success, anErrorobject on failureimageUrl- The URL to the uploaded image
Non-object method name: sendImageToUser
v3.41.0 or later is required to use this method.
Uploads an image to Steam and automatically sends it to a user over Steam chat as an embed.
getComments([options, ]callback)
options- Optional. An object containing zero or more of these properties:start- The offset of the first comment you want to retrieve (default 0)count- How many comments you want to retrieve
callback- Called when the request completeserr- AnErrorobject on failure, ornullon successcomments- An array containing objects representing the commentsid- The ID of the commentauthorsteamID- ASteamIDobjectname- The commenter's nameavatar- A URL to the commenter's avatarstate- offline/online/in-game
date- ADateobjecttext- The text of the comment. May contain special characters like newlines or tabshtml- The rendered HTML of the comment
totalCount- The total number of comments on this profile
Non-object method name: getUserComments
v3.43.1 or later is required to use this method
Gets comments from a user's Steam profile.
deleteComment(commentID[, callback])
commentID- The ID of the comment you want to deletecallback- Optional. Called when the request completeserr- AnErrorobject on failure, ornullon success
Non-object method name: deleteUserComment
v3.43.0 or later is required to use this method
Deletes a comment from a user's profile. Must be your own profile, or your own comment on someone else's profile.
follow([callback])
callback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: followUser
v3.47.0 or later is required to use this method.
Follows the user and their workshop.
unfollow([callback])
callback- Optional.err-nullon success, anErrorobject on failure
Non-object method name: unfollowUser
v3.47.0 or later is required to use this method.
Unfollows the user and their workshop.