@source/rich-presence-sdk (0.1.0)

Published 2026-02-13 20:17:04 +00:00 by hibna

Installation

@source:registry=
npm install @source/rich-presence-sdk@0.1.0
"@source/rich-presence-sdk": "0.1.0"

About this package

@source/rich-presence-sdk

Source rich presence SDK for external applications.

What It Solves

  • Send Playing, Listening, Watching activities to Source.
  • Manage auth tokens for external apps (login + refresh) with SourceAuthSession.
  • Retry presence updates after token expiration (401) with minimal boilerplate.

Important

  • SDK does not auto-discover the user account.
  • You must provide one of:
    • email + password, or
    • a valid refreshToken

Quick Start

import {
  PresenceActivityType,
  SourceAuthSession,
  SourceRichPresenceClient,
} from "@source/rich-presence-sdk";

const session = new SourceAuthSession({
  apiBaseUrl: "https://discord.hibna.com.tr/api",
  email: process.env.SOURCE_EMAIL,
  password: process.env.SOURCE_PASSWORD,
  // or: refreshToken: process.env.SOURCE_REFRESH_TOKEN,
});

await session.initialize();

const client = new SourceRichPresenceClient({
  apiBaseUrl: "https://discord.hibna.com.tr/api",
  accessToken: session.getAccessTokenOrThrow(),
});

await client.setActivity({
  type: PresenceActivityType.PLAYING,
  name: "My External App",
  details: "In a live match",
  state: "Room Alpha",
});

External Integration Template

Use examples/external-app-template.ts as a base:

  • Initializes session from env.
  • Creates rich presence client.
  • Periodically refreshes tokens.
  • Retries on 401.
  • Maps external app state to presence payload.

Suggested Environment Variables

  • SOURCE_API_BASE_URL (optional, default: https://discord.hibna.com.tr/api)
  • SOURCE_EMAIL (optional if refresh token exists)
  • SOURCE_PASSWORD (optional if refresh token exists)
  • SOURCE_REFRESH_TOKEN (optional if email/password exists)

Dependencies

Dependencies

ID Version
@source/shared ^0.1.0

Development Dependencies

ID Version
@source/tsconfig workspace:*
typescript ^5.7.3
Details
npm
2026-02-13 20:17:04 +00:00
2
6.9 KiB
Assets (1)
Versions (2) View all
0.2.0 2026-02-14
0.1.0 2026-02-13