-
-
Notifications
You must be signed in to change notification settings - Fork 159
SteamChatRoomClient
Available as a chat
property on every SteamUser
instance, SteamChatRoomClient
is how you can interact
programmatically with "new Steam chat", including the new chat rooms.
Unlike most SteamUser
methods and events, these are all only available from the SteamChatRoomProperty
via the chat
property. For example:
let user = new SteamUser();
// log on the user
user.chat.sendFriendMessage("[U:1:46143802]", "Hello, world!");
- Concepts
- Standard Objects
-
Methods
- getGroups(callback)
- getInviteLinkInfo(linkUrl, callback)
- getClanChatGroupInfo(clanSteamID, callback)
- joinGroup(groupId[, inviteCode], callback)
- inviteUserToGroup(groupId, steamId[, callback])
- sendFriendMessage(steamId, message[, options][, callback])
- sendFriendTyping(steamId[, callback])
- sendChatMessage(groupId, chatId, message[, callback])
- deleteChatMessages(groupId, chatId, messages[, callback])
- kickUserFromGroup(groupId, steamId[, expireTime][, callback])
- getChatMessageHistory(groupId, chatId[, options], callback)
- Events
Concepts ^
Each message in new Steam chat has both a timestamp
and an ordinal
. The timestamp
value should be self-explanatory,
but the ordinal
value is a 0-indexed counter that increments if a user sends multiple messages within the same second.
This enables messages to be identified uniquely using only their timestamp and their ordinal.
All three of the above are distinctly separate things in Steam.
- Chat Rooms - Internally, Steam calls chat channels "chat rooms". When you see the term "chat room", think "channel".
- Chat Room Groups - Think "Discord server". This is a "group chat" on your friends list. Chat room groups are owned by one individual, and can have multiple text and voice channels.
- Steam Groups - Steam groups have pretty much nothing to do with chat room groups/chat rooms, except that there's a
button on a Steam group's overview page to join a chat room group which is linked to that Steam group. Internally though,
Steam groups and chat room groups are entirely separate things, linked only by
getClanChatGroupInfo(clanSteamID, callback) and by the
clanid
property in Chat Room Group Header State.
Standard Objects ^
"Standard objects" are objects that are reused across multiple methods and events in the SteamChatRoomClient
.
-
chat_rooms
- An array of Chat Room State objects -
top_members
- An array ofSteamID
objects representing the group's "top members" -
chat_group_id
- The ID of this chat room group -
chat_group_name
- The name of this chat room group -
active_member_count
- An integer representing how many members are active -
active_voice_member_count
- An integer representing how many members are active in voice -
default_chat_id
- A string containing the numeric ID of the default chat room (channel) in this group -
chat_group_tagline
- The group's tagline -
appid
- If the chat group is linked to an app, this is its AppID. Otherwise,null
. -
steamid_owner
- ASteamID
object representing the group's owner -
watching_broadcast_steamid
- If the group is in a broadcast watch party, this is theSteamID
of the broadcaster -
chat_group_avatar_sha
- If the group has an avatar set, this is its SHA-1 hash, as aBuffer
. If not,null
. -
chat_group_avatar_url
- If the group has an avatar set, this is the URL where you can download it. If not,null
.
-
members
- An array of Chat Room Member objects -
chat_rooms
- An array of Chat Room State objects -
kicked
- An array of Chat Room Member objects for who got kicked -
default_chat_id
- A string containing the numeric ID of the default chat room (channel) in this group -
header_state
- A Chat Room Group Header State object
-
chat_group_id
- A string containing the numeric ID of the chat room group in question -
time_joined
- ADate
object representing when you joined this group -
user_chat_room_state
- An array of User Chat Room State objects -
desktop_notification_level
- A value from EChatRoomNotificationLevel -
mobile_notification_level
- A value from EChatRoomNotificationLevel -
time_last_group_ack
- ADate
object representing when you last acknowledged messages in this group.null
if never. -
unread_indicator_muted
-true
if you have muted the unread indicator for this group
-
chat_id
- A string containing the numeric ID of the chat room in question -
time_joined
- ADate
object representing when you joined this chat room -
time_last_ack
- ADate
object representing when you last acknowledged messages in this chat room.null
if never. -
desktop_notification_level
- A value from EChatRoomNotificationLevel -
mobile_notification_level
- A value from EChatRoomNotificationLevel -
time_last_mention
- ADate
object representing when you were last mentioned in this chat room.null
if never. -
unread_indicator_muted
-true
if you have muted the unread indicator for this room
-
chat_group_id
- The ID of this chat room group -
chat_name
- The name of this group -
clanid
- If this is a chat room group linked to a Steam group, this is the associated Steam group'sSteamID
object, ornull
if not linked to a group. -
steamid_owner
- ASteamID
object representing the owner of this chat room group -
appid
- If the chat group is linked to an app, this is its AppID. Otherwise,null
. -
tagline
- The group's tagline -
avatar_sha
- If the group has an avatar set, this is its SHA-1 hash, as aBuffer
. If not,null
. -
avatar_url
- If the group has an avatar set, this is the URL where you can download it. If not,null
. -
default_role_id
- The ID of the default role applied to new members -
roles
- An array of Chat Role objects -
role_actions
- An array of Chat Role Actions objects -
watching_broadcast_steamid
- If the group is in a broadcast watch party, this is theSteamID
of the broadcaster
-
steamid
- The member'sSteamID
-
state
- A value from EChatRoomJoinState -
rank
- A value from EChatRoomGroupRank -
time_kick_expire
- ADate
object of when this member's kick expires, ornull
if not kicked -
role_ids
- An array of this member's applied role IDs
-
chat_id
- A string containing this chat room (channel)'s numeric ID -
chat_name
- The name of this room (channel) -
voice_allowed
-true
if voice is allowed in this room -
members_in_voice
- An array ofSteamID
objects for who's in this room's voice chat -
time_last_message
- ADate
object representing when the last message was sent to this room -
sort_order
- An integer determining how this room is sorted within its chat group
-
role_id
- A string containing this role's numeric ID -
name
- The name of this role -
ordinal
- An integer determining how this role is sorted within its chat group
-
role_id
- A string containing the associated role's numeric ID -
can_create_rename_delete_channel
- Boolean -
can_kick
- Boolean -
can_ban
- Boolean -
can_invite
- Boolean -
can_change_tagline_avatar_name
- Boolean -
can_chat
- Boolean -
can_view_history
- Boolean -
can_change_group_roles
- Boolean -
can_change_user_roles
- Boolean -
can_mention_all
- Boolean -
can_set_watching_broadcast
- Boolean
-
steamid_friend
- ASteamID
object -
chat_entry_type
- A value from EChatEntryType -
from_limited_account
- This istrue
if the message sender is a limited Steam account -
message
- The message text -
message_no_bbcode
- The message text without BBCode tags (if possible; may still contain BBCode for text that has no plaintext alternative, e.g. [flip]) -
server_timestamp
- ADate
object for this message's timestamp -
ordinal
- This message's ordinal -
local_echo
- This istrue
if this is a message you sent on another client that is being "echoed" to another client instance -
low_priority
- Boolean
-
chat_group_id
- The ID of the chat room group this was sent to -
chat_id
- The ID of the chat room (channel) this was sent to -
steamid_sender
- ASteamID
object -
message
- The message text -
message_no_bbcode
- The message text without BBCode tags (if possible; may still contain BBCode for text that has no plaintext alternative, e.g. [flip]) -
server_timestamp
- ADate
object for this message's timestamp -
ordinal
- This message's ordinal -
mentions
- A Chat Mentions object, ornull
-
server_message
- A Server Message object, ornull
-
mention_all
- Boolean -
mention_here
- Boolean -
mention_steamids
- An array ofSteamID
objects
-
message
- A value from EChatRoomServerMessage -
string_param
- An optional string parameter -
steamid_param
- An optionalSteamID
object
Methods ^
-
callback
- Called when the request completes-
err
- AnError
object on failure, ornull
on success -
response
- The response object-
chat_room_groups
- An object where keys are numeric chat room group IDs and values are objects with these keys:-
group_summary
- A Chat Room Group Summary object -
group_state
- A Chat Room Group State object
-
-
-
Returns a list of all chat room groups you are a member of.
-
linkUrl
- The full invite link URL for a group chat (e.g.https://s.team/chat/abcdefg
) -
callback
- Called when the request completes-
err
- AnError
object on failure, ornull
on success -
response
- The response object-
invite_code
- The invite code from the link -
steamid_sender
- ASteamID
object containing the ID of the person who created the invite link -
time_expires
- ADate
object containing the time when this invite link expires -
group_summary
- A Chat Room Group Summary object -
time_kick_expire
- ADate
object containing the time when your kick from this group will expire, ornull
if you aren't on a kick cooldown -
banned
-true
if you are banned from this group
-
-
Gets details about a chat room group from an invite link. If the provided invite link is not valid, you will get an
Error
with message "Invalid invite link"
.
-
clanSteamID
- The group'sSteamID
or a string that can parse into one -
callback
- Called when the request completes-
err
- AnError
object on failure, ornull
on success -
response
- The response object-
chat_group_summary
- A Chat Room Group Summary object
-
-
Get details about a clan (Steam group)'s chat room group. The returned summary includes the group's chat room group ID, which you can use with joinGroup to join that group chat. You do not need an invite code to join a Steam group chat that you have access to.
-
groupId
- The chat group ID you want to join (group_summary.chat_group_id
ingetInviteLinkInfo
response) -
inviteCode
- The invite code you were provided to join this group. Not necessary if you're joining the chat room for a Steam group you have access to. -
callback
- Called when the request completes-
err
- AnError
object on failure, ornull
on success -
response
- The response object-
state
- A Chat Room Group State object -
user_chat_state
- A User Chat Room Group State object
-
-
Requests to join a chat room group. If the provided group ID or invite code are not valid, you will get an Error
with
message "Invalid group ID or invite code"
.
-
groupId
- The chat group ID you want to invite a friend to -
steamId
- Your friend'sSteamID
object, or a string that can parse into one -
callback
- Optional. Called when the request completes-
err
- AnError
object on failure, ornull
on success
-
Invites a Steam friend to join a chat room group. You must have permission to do so.
Always returns success, even if you don't have permission to send this invite.
-
steamId
- The SteamID of your friend, as aSteamID
object or a string that can parse into one -
message
- The string message you want to send -
options
- Optional. An object containing zero or more of these properties:-
chatEntryType
- A value from EChatEntryType. Defaults toChatMsg
. -
containsBbCode
-true
to allow the Steam server to parse /commands (defaulttrue
)
-
-
callback
- Optional. Called when the request completes-
err
- AnError
object on failure, ornull
on success -
response
- The response object-
modified_message
- A string containing the message as it will be broadcast to the other user. If any /commands got parsed and turned into BBCode, you'll see that BBCode here. -
server_timestamp
- ADate
object containing the timestamp the server gave to this message. -
ordinal
- This message's ordinal
-
-
Sends a chat message to a friend.
-
steamId
- The SteamID of your friend, as aSteamID
object or a string that can parse into one -
callback
- Optional. Called when the request completes-
err
- AnError
object on failure, ornull
on success
-
Notifies a friend that you are typing a chat message to them.
-
groupId
- The ID of the chat room group you want to send this message to -
chatId
- The ID of the chat room (channel) you want to send this message to -
message
- Your actual message text -
callback
- Optional. Called when the request completes-
err
- AnError
object on failure, ornull
on success -
response
- The response object-
modified_message
- A string containing the message as it will be broadcast to the other user. If any /commands got parsed and turned into BBCode, you'll see that BBCode here. -
server_timestamp
- ADate
object containing the timestamp the server gave to this message. -
ordinal
- This message's ordinal
-
-
Sends a chat message to a chat channel.
-
groupId
- The ID of the chat room group you want to delete a message from -
chatId
- The ID of the chat room (channel) you want to delete a message from -
messages
- An array of objects with these properties:-
server_timestamp
- Either aDate
or a numeric Unix timestamp (you may also name this propertytimestamp
) -
ordinal
- The ordinal of the message you want to delete. May be omitted if 0.
-
-
callback
- Optional. Called when the request completes-
err
- AnError
object on failure, ornull
on success
-
Deletes some messages from a chat room, provided you have access. Note that the message sender gets no indication that their message was deleted, but everyone else sees [MESSAGE DELETED].
Always returns success, even if you don't have permission to delete the messages in question or you provided bad timestamps/ordinals.
-
groupId
- The ID of the chat room group you want to kick someone from -
steamId
- TheSteamID
object for the user you want to kick, or a string that can parse into one -
expireTime
- ADate
object or numeric Unix timestamp for when the user should be permitted to rejoin. Omit to allow them to rejoin immediately (provided they have an invite link) -
callback
- Optional. Called when the request completes-
err
- AnError
object on failure, ornull
on success
-
Kicks a user from a chat room group, provided you have access to do so.
Always returns success, even if you don't have permission to kick the user in question.
-
groupId
- The ID of the chat room group you want history in -
chatId
- The ID of the chat room (channel) you want history in -
options
- Optional. An object containing zero or more of these properties-
maxCount
- The maximum number of messages to return. Default 100. -
lastTime
- The latest timestamp you want messages for, as aDate
object or Unix timestamp. -
lastOrdinal
- The last ordinal you want messages for. -
startTime
- The earliest timestamp you want messages for, as aDate
object or Unix timestamp. -
startOrdinal
- The first ordinal you want messages for.
-
-
callback
- Called when the request completes-
err
- AnError
object on failure, ornull
on success -
response
- The response object-
messages
- An array of objects with these properties-
sender
- ASteamID
object -
server_timestamp
- ADate
object for the message's timestamp -
ordinal
- The message's ordinal -
message
- The message text -
server_message
- An optional Server Message object -
deleted
- Boolean indicating whether the message is deleted
-
-
more_available
- Boolean
-
-
Retrieves chat message history from a chat room group.
Events ^
-
message
- An Incoming Friend Message object
Emitted when a friend sends you a direct message.
-
message
- An Incoming Friend Message object
Emitted when you send a direct message to a friend on another client instance.
-
message
- An Incoming Friend Message object
Emitted when a friend is typing you a direct message.
-
message
- An Incoming Friend Message object
Emitted when you are typing a friend a direct message on another client instance.
This has not been tested and may not be emitted.
-
message
- An Incoming Friend Message object
Emitted when a friend has closed their direct chat window with you.
This has not been tested and may not be emitted.
-
message
- An Incoming Friend Message object
Emitted when you close your direct chat window with a friend on another instance.
This has not been tested and may not be emitted.
-
message
- An Incoming Chat Message object
Emitted when a message is sent to a chat room you're in.
-
details
- An object containing these properties-
chat_group_id
- The ID of the chat room group containing the modified messages -
chat_id
- The ID of the chat room (channel) containing the modified messages -
messages
- An array of objects containing these properties-
server_timestamp
- ADate
object for the timestamp of the message in question -
ordinal
- The ordinal of the message in question -
deleted
- Boolean determining if the message was deleted
-
-
Emitted when chat messages are modified (deleted) in a chat room you're in.