-
-
Notifications
You must be signed in to change notification settings - Fork 128
Steam Chat
As of v2.2.0, node-steamcommunity
allows you to use Steam Chat via Steam's web chat service. Chat is accessed through properties, methods, and events on your SteamCommunity
object.
WEBCHAT VIA NODE-STEAMCOMMUNITY IS DEPRECATED AND WILL BE REMOVED IN A FUTURE RELEASE. Steam's new webchat goes through the CM servers, so you should use node-steam-user instead.
The current state of our chat connection. One of the following values:
SteamCommunity.ChatState = {
"Offline": 0,
"LoggingOn": 1,
"LogOnFailed": 2,
"LoggedOn": 3
};
You can only send and receive chat messages if this value is LoggedOn
.
-
interval
- The interval in milliseconds between polling requests (default 500) -
uiMode
-web
to get a globe icon next to your name,mobile
to get a phone icon (defaultweb
)
v2.4.0 or later is required to use the uiMode
argument
Starts logging you into web chat. Steam web chat uses long polling so a short interval
value should be safe. Default is 500
.
Listen for the chatLoggedOn
event to know when you're successfully logged on. Listen for the chatLogOnFailed
as there may be a fatal error while logging on.
-
recipient
- The recipient of our message, as aSteamID
object or something that can parse into aSteamID
object (STEAM_0:0:23071901
,[U:1:46143802]
, or76561198006409530
formats) -
text
- The message text -
type
- Optional. The type of message you're sending. Default issaytext
. Another possible value istyping
. -
callback
- Optional. Called when the message is successfully sent or an error occurs.-
err
- AnError
object on failure,null
on success
-
Sends a chat message to a recipient. A saytext
message is a regular chat message. If you send a typing
message, text
is ignored and the recipient's chat window will say that you're typing for 20 seconds.
Logs you off of chat.
-
err
- AnError
object -
fatal
-true
if this is a fatal error,false
if not (will keep trying to connect if not fatal)
v3.19.10 or later is required to use this event
Emitted when there's a problem while logging into webchat.
Emitted in response to a call to chatLogon()
when we successfully logged on.
-
steamID
- The SteamID of the user for whom we just got persona data, as aSteamID
object -
persona
- The user's persona data
Emitted when we receive new persona state data for a friend. Properties of persona
are as follows:
-
steamID
- ASteamID
object -
personaName
- A string containing their (new) name -
personaState
- A value from thePersonaState
enum (see below) -
personaStateFlags
- An integer containing zero or more flags from thePersonaStateFlag
enum (see below) -
avatarHash
- The user's avatar hash (see below) -
inGame
-true
if the user is currently in-game,false
if not -
inGameAppID
- An integer containing the AppID of the app the user is currently playing/using, or 0 if not in-game -
inGameName
- The name of the app the user is currently playing/using, ornull
if not in-game
SteamCommunity.PersonaState = {
"Offline": 0,
"Online": 1,
"Busy": 2,
"Away": 3,
"Snooze": 4,
"LookingToTrade": 5,
"LookingToPlay": 6,
"Max": 7
};
SteamCommunity.PersonaStateFlag = {
"HasRichPresence": 1,
"InJoinableGame": 2,
"OnlineUsingWeb": 256,
"OnlineUsingMobile": 512,
"OnlineUsingBigPicture": 1024
};
To get a URL from an avatar hash, use SteamCommunity.CSteamUser.getAvatarURL(hash[, size][, protocol])
, where size
is one of full
, medium
, icon
(default icon
) and protocol
is one of http://
, https://
, //
(default http://
).
-
sender
- The sender's SteamID, as aSteamID
object -
text
- The message text
Emitted when we receive a new chat message.
-
sender
- The sender's SteamID, as aSteamID
object
Emitted when we receive a notification that someone is typing a message.
Emitted in response to a chatLogoff()
call when we successfully logged off.