Entity Info
getUserStatus
$getUserStatus
The function $getUserStatus[] returns the presence status of a user on Discord.
Syntax
$getUserStatus[(userID)]
Parameters
| Parameter | Description |
|---|---|
userID |
Optional - Accepted but ignored by the engine: the status returned is always the user.status value supplied by the host. |
Return Value
- Type: String
- The status supplied by the host in the
user.statuscontext variable (for exampleonline,idle,dnd,offline). offlineif the host supplied no status.
Behavior
- The function can be called with no parameter or with one parameter; the parameter has no effect and the status of another user cannot be queried.
- The engine does not query Discord itself: it only reads the
user.statuscontext variable.
Examples
Display the status with an emoji
$var[status;$getUserStatus]
$if[$var[status]==online]
$var[emoji;🟢]
$elseif[$var[status]==idle]
$var[emoji;🟡]
$elseif[$var[status]==dnd]
$var[emoji;🔴]
$else
$var[emoji;⚫]
$endif
$title[Status of $userName]
$description[**Status:** $var[emoji] $var[status]]
$color[#5865F2]
Do not disturb
$if[$getUserStatus==dnd]
$sendMessage[⚠️ You are in Do Not Disturb mode.]
$endif
Notes
offlineis also the value returned when no status is available.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.