This is a handler for Community functionality. Initialize it by passing a SteamClient instance to the constructor.
var steamFriends = new Steam.SteamFriends(steamClient);
Chat-related methods automatically convert ClanIDs (group's SteamID) to ChatIDs. Conversely, ChatIDs are converted to ClanIDs in chat-related events if it's a group chat (i.e. not an "ad hoc" chat), otherwise left alone. In the following docs, chat SteamID always refers to ClanID for group chats and ChatID otherwise.
Information about users you have encountered. It's an object whose keys are SteamIDs and values are CMsgClientPersonaState.Friend
objects.
Information about groups you have encountered. It's an object whose keys are SteamIDs and values are CMsgClientClanState
objects.
Information about chat rooms you have joined. It's an object with the following structure:
{
"steamID of the chat": {
"steamID of one of the chat's current members": {
rank: "EClanPermission",
permissions: "a bitset of values from EChatPermission"
}
// other members
}
// other chats
}
For example, Object.keys(steamClient.chatRooms[chatID])
will return an array of the chat's current members, and steamClient.chatRooms[chatID][memberID].permissions & Steam.EChatPermission.Kick
will evaluate to a nonzero value if the specified user is allowed to kick from the specified chat.
An object that maps users' SteamIDs to their EFriendRelationship
with you. Empty until 'relationships' is emitted. 'friend' is emitted before this object changes.
An object that maps groups' SteamIDs to their EClanRelationship
with you. Empty until 'relationships' is emitted. 'group' is emitted before this object changes.
Changes your Steam profile name.
You'll want to call this with EPersonaState.Online
upon logon, otherwise you'll show up as offline.
Last parameter defaults to EChatEntryType.ChatMsg
. Another type you might want to use is EChatEntryType.Emote
.
Sends a friend request.
Removes a friend.
Attempts to join the specified chat room. The result should arrive in the 'chatEnter' event.
Leaves the specified chat room. Will silently fail if you are not currently in it. Removes the chat from chatRooms
.
Locks and unlocks a chat room respectively.
Enables and disables officers-only chat respectively.
kick(chatSteamID, memberSteamID), ban(chatSteamID, memberSteamID), unban(chatSteamID, memberSteamID)
Self-explanatory.
Invites the specified user to the specified chat.
Requests the Steam level of a number of specified accounts. The steamids
argument should be an array of SteamIDs.
The single object parameter of the callback
has the requested SteamIDs as properties and the level as their values. Example:
{
"76561198006409530": 62,
"76561197960287930": 7
}
Requests friend data. steamIDs
must be an array. requestedData
is optional – if falsy, defaults to EClientPersonaStateFlag.PlayerName | EClientPersonaStateFlag.Presence | EClientPersonaStateFlag.SourceID | EClientPersonaStateFlag.GameExtraInfo
. The response, if any, should arrive in the 'personaState' event.
Blocks a friend if setIgnore
is true
, unblocks them if it's false
. The first argument to callback
will be EResult
.
- SteamID of the chat you were invited to
- name of the chat
- SteamID of the user who invited you
Someone has gone offline/online, started a game, changed their nickname or something else. Note that the personaStates
property is not yet updated when this event is fired, so you can compare the new state with the old one to see what changed.
Some group has posted an event or an announcement, changed their avatar or something else. Note that the clanStates
property is not yet updated when this event is fired, so you can compare the new state with the old one to see what changed.
The friends
and groups
properties now contain data (unless your friend/group list is empty). Listen for this if you want to accept/decline friend requests that came while you were offline, for example.
- SteamID of the user
EFriendRelationship
Some activity in your friend list. For example, EFriendRelationship.RequestRecipient
means you got a friend invite, EFriendRelationship.None
means you got removed. The friends
property is updated after this event is emitted.
- SteamID of the group
EClanRelationship
Some activity in your group list. For example, EClanRelationship.Invited
means you got invited to a group, EClanRelationship.Kicked
means you got kicked. The groups
property is updated after this event is emitted.
- SteamID of the user
- the message
EChatEntryType
- SteamID of the chat room
- the message
EChatEntryType
- SteamID of the chatter
Same arguments as the above two, captures both events. In case of a friend message, the fourth argument will be undefined.
Same as 'friendMsg', except it is a message you send to a friend on another client.
- SteamID of the chat room
EChatRoomEnterResponse
The result of attempting to join a chat. If successful, the list of chat members is available in chatRooms
.
EChatMemberStateChange
- SteamID of the user who entered or left the chat room, disconnected, or was kicked or banned
- SteamID of the chat where it happened
- SteamID of the user who kicked or banned
Something happened in a chat you are in. For example, if the first argument equals Steam.EChatMemberStateChange.Kicked
, then someone got kicked.
- SteamID of the chat
EChatInfoType
In case of EChatInfoType.InfoUpdate
, there are two extra arguments:
- A bitset of values from
EChatFlags
- SteamID of the user who initiated the change