-
-
Notifications
You must be signed in to change notification settings - Fork 146
CSteamUser
A class which stands for a Steam user. This class cannot be instantiated directly; it must be received from a call to getSteamUser.
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... */
});A SteamID object containing the user's SteamID. Visit a user's profile at https://steamcommunity.com/profiles/SteamID
The user's current profile name (can be changed).
The user's current online state. One of in-game, online, or offline.
A message describing the user's current online state. Displayed on the profile below their status.
One of public, friendsonly, private. May also be a legacy value like friendsfriendsonly, these should be treated as private.
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.
The hash of the user's avatar.
true if the user has one or more VAC bans on record, false otherwise.
One of None, Probation, or Banned.
true if the user's account is limited, false otherwise.
The user's custom vanity URL.
A Date object for the user's account creation date (unavailable and null if private)
The user's given location (unavailable and null if private or not provided)
The user's given real name (unavailable and null if private or not provided)
The user's profile summary (unavailable and null if private)
An array of SteamID objects for the user's joined groups.
A SteamID object for the user's chosen primary group.
-
size- Optional. One ofsmall(default),medium,full -
protocol- Optional. One ofhttp://(default),https://,//(protocol aware)
Returns a URL where you can download this user's avatar image.
-
callback- Optional.-
err-nullon success, anErrorobject on failure
-
Non-object method name: addFriend
Adds the user as a friend.
-
callback- Optional.-
err-nullon success, anErrorobject on failure
-
Non-object method name: acceptFriendRequest
Accepts a pending friend request from this user.
-
callback- Optional.-
err-nullon success, anErrorobject on failure
-
Non-object method name: removeFriend
Removes the user from your friends list.
-
callback- Optional.-
err-nullon success, anErrorobject on failure
-
Non-object method name: blockCommunication
Blocks all communication with the user.
-
callback- Optional.-
err-nullon success, anErrorobject on failure
-
Non-object method name: unblockCommunication
Removes the user from your blocked list.
-
message- The message to leave on the user's profile -
callback- 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.
-
groupID- The SteamID of the group, as aSteamIDobject or a string which can be parsed into one -
callback- 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.
-
callback- Required. Called when the requested data is available.-
err-nullon success, anErrorobject on failure -
apps- 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.
-
appID- The AppID of the app which owns the inventory you want to retrieve -
contextID- The ContextID of the context within the app you want to load -
tradableOnly-trueto only get tradable items,falseto get all -
callback- 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.
-
appID- The AppID of the app which owns the inventory you want to retrieve -
contextID- The ContextID of the context within the app you want to load -
tradableOnly-trueto only get tradable items,falseto get all -
language- 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 failure -
inventory- An array containingCEconItemobjects for the user's inventory items -
currency- 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.
-
callback- Required. Called when requested data is available.-
err-nullon success, anErrorobject on failure -
aliases- 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 name -
timechanged- 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.
-
callback- Required. Called when requested data is available.-
err-nullon success, anErrorobject on failure -
backgroundUrl- 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.
-
imageContentsBuffer- The content of the image you wish to send, as aBuffer -
options- 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 completes-
err-nullon success, anErrorobject on failure -
imageUrl- 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.
-
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 completes-
err- AnErrorobject on failure, ornullon success -
comments- An array containing objects representing the comments-
id- The ID of the comment -
author-
steamID- ASteamIDobject -
name- The commenter's name -
avatar- A URL to the commenter's avatar -
state- offline/online/in-game
-
-
date- ADateobject -
text- The text of the comment. May contain special characters like newlines or tabs -
html- 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.
-
commentID- The ID of the comment you want to delete -
callback- Optional. Called when the request completes-
err- 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.
-
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.
-
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.