Skip to content

Status and presence

Every member has a presence: a status (online, idle, do not disturb, or offline) and optionally an activity, what they are doing (“Playing chess”, “Listening to lofi radio”). A member can also set a custom status text with an emoji, which the host keeps until it is changed or expires. Bots have the same presence as members (bots: status and presence).

Presence is set once for the whole client and goes to every community it is connected to.

client.setPresence("online", { type: "listening", name: "lofi radio", state: "ChilledCow" });
client.setPresence("dnd"); // no activity
client.setPresence("invisible"); // everyone else sees you offline

setPresence returns false, and sends nothing, when the status or the activity is not valid.

Status Everyone else sees
online online
idle idle (away)
dnd do not disturb
invisible offline, with no activity

An activity has a type (kind in Rust): playing, streaming, listening, watching, competing or custom; a name; and optionally details and state (a second and third line), started_at (ms since the epoch, to show an elapsed time), url (an https:// link, streaming only) and emoji (custom only).

The host shows at most one change per member every 3 seconds. Call it as often as you like: the client keeps the latest, sends it when the window allows, and sends it again after each reconnection.

The custom status is set per community, and the host keeps it (presence is live only).

await community.setStatusText("Back soon", { emoji: "☕", expiresAt: new Date(Date.now() + 3_600_000) });
await community.setStatusText("Reviewing PRs"); // kept until changed
await community.setStatusText(null); // clears it

When it is set, changed, cleared or expires, everyone else gets a member update (memberUpdate / Event::MemberUpdate).

const verbs = { playing: "Playing", streaming: "Streaming", listening: "Listening to",
watching: "Watching", competing: "Competing in" };
const line = (a) => a.type === "custom" ? `${a.emoji ?? ""} ${a.name}`.trim() : `${verbs[a.type]} ${a.name}`;
client.on("presenceUpdate", ({ member, status, activity }) => {
showPresence(member, status, activity ? line(activity) : null);
});
member.presence; // { status: "online" | "idle" | "dnd" | "offline", activity }
member.statusText; // custom status text, or null
member.statusEmoji; // its emoji, or null
community.presences; // every member who is not offline: [{ member, status, activity }]

After a community is ready, the client loads who is online and emits presencesReady (Event::PresencesReady); from then on each change arrives as presenceUpdate (Event::PresenceUpdate). Invisible members look offline, and a member who goes offline leaves community.presences.

A streaming activity’s link should open only after the reader confirms. Activities carry no pictures and no other links, so showing one never makes your app fetch anything.

Item Limit
Activity name 1–128 characters
Activity details, state 0–128 characters each
Custom status text 1–128 characters, plus an optional emoji
Emoji one Unicode emoji, ≤ 64 bytes
Presence changes shown one every 3 s per member; the latest wins