Getting Started
Sharing
Sharing and availability
Enable Discord presence sharing
Join the official Discord community and use the /confirm command to make your opted-in presence available to PresenceKit. Use /disconnect to revoke access.
PresenceKit only exposes presence for users who have chosen to share it. Being a Discord user is not, by itself, enough.
Enable or disable sharing
1. Join the official PresenceKit Discord community linked from the project.
2. Use /confirm to opt in to public presence sharing.
3. Use /disconnect to revoke sharing.
No Discord login or application token is needed in the website consuming the SDK.
Handle the API states
getPresence(id) returns a PresenceResult when that ID is approved:
availability: "live"— a snapshot is available;presencemay contain status and activity details.availability: "pending"— an approved profile exists but a snapshot may not yet be available;presencecan benull.spotify: null— no currently reported Spotify activity; not necessarily an error.
An unapproved or revoked ID does not produce ordinary profile data; requests may throw PresenceKitError (for example, HTTP 404). Always handle that separately from pending.
import { createPresenceClient, PresenceKitError } from "@iconical/presencekit";
try {
const data = await createPresenceClient().getPresence("123456789012345678");
if (!data.presence) console.log("Waiting for a presence update");
} catch (error) {
if (error instanceof PresenceKitError && error.status === 404) {
console.log("Presence not available or sharing disabled");
} else {
console.error("Request failed", error);
}
}Batch requests omit IDs without authorized data. Do not infer users' status or retain stale presence after an error.
See privacy and troubleshooting.
Was this page helpful?