Api Reference
Types
Types and response shapes
All the following types are available from @iconical/presencekit.
PresenceResult
import type { PresenceResult } from "@iconical/presencekit";
type Summary = Pick<PresenceResult, "availability" | "profile" | "presence" | "spotify">;| Property | Type | Meaning | |
|---|---|---|---|
ok | true | Request succeeded | |
availability | `"live" \ | "pending"` | Whether a snapshot is available |
profile | DiscordProfile | Basic approved public profile | |
presence | `PresenceSnapshot \ | null` | Current status and activities, if available |
spotify | `SpotifyNowPlaying \ | null` | Convenient currently reported Spotify details |
DiscordProfile
Includes id, username, displayName, avatarUrl, bannerUrl, avatarDecorationUrl, and optional Discord profile metadata such as globalName and accentHex.
PresenceSnapshot
interface ExampleSnapshot {
userId: string;
status: "online" | "idle" | "dnd" | "offline";
devices: Record<string, string>;
updatedAt: string;
activities: PresenceActivity[];
}A user may have multiple activities. Don't read only activities[0] unless your design intentionally shows one.
PresenceActivity
Notable fields: name, type, typeName, details, state, applicationId, timestamps, assets, artwork, party, emoji, url, syncId, and buttons. Many values can be null. type can be compared with DiscordActivityType.
SpotifyNowPlaying
Includes song, artist, artists, album, albumArtUrl, trackId, trackUrl, startedAt, endsAt, durationMs, and progressMs. Duration and progress are millisecond values or null.
PresenceBatchResult
interface ExampleBatch {
ok: true;
presences: Record<string, PresenceResult>;
}The map contains authorized users only. Missing keys are normal when sharing is disabled.
Errors and transport
PresenceKitErrorextendsErrorwith.codeand.status.PresenceTransportis"auto" | "sse" | "poll".PresenceSubscriptionOptionssupportstransport,intervalMs,onTransportChange.ConnectionDiagnosticsincludesmode,activeConnections,subscribers,users,lastUpdateAt,lastError.
Read client methods, helpers, or the source types.
Was this page helpful?