Game activity & local RPC
Connect a Windows game or app to a Riscord profile without a bot token.
Examples use the bot client from Your first bot.
Before you connect
- Install Riscord 0.1.33 or newer on Windows and sign in.
- In Settings → Activity, enable Share game activity and Rich Presence. Sharing is off by default.
- Create an application in the Developer Portal and copy its application ID. Its name and avatar identify your activity.
- Install SDK 0.4.0 or newer. Keep the application ID as a string. You do not need to generate a bot token or install a bot in a server.
Local RPC is available on Windows. The browser, Android, Linux and macOS previews do not expose this local pipe. Automatic Windows game detection still works when Rich Presence is disabled.
Share an activity
Python uses the default Windows Proactor event loop. Both clients reconnect after an established connection drops and resend their latest activity. Initial connection failures reject; retry them when your app is ready.
import { RPCClient } from '@riscord/bot/rpc';
const rpc = new RPCClient({ clientId: process.env.RISCORD_APPLICATION_ID });
await rpc.connect();
await rpc.setActivity({
details: 'Exploring the world',
state: 'With friends',
timestamps: { start: Math.floor(Date.now() / 1000) },
buttons: [{ label: 'Game website', url: 'https://example.com/' }],
});
process.once('SIGINT', () => { rpc.destroy(); process.exit(0); });
process.once('SIGTERM', () => { rpc.destroy(); process.exit(0); });Activity fields
| Field | Limit |
|---|---|
| details / state | Optional plain text, 1–128 characters each |
| timestamps.start | Optional Unix seconds, within the past seven days. Omit for the session start time. |
| buttons | Up to two public HTTPS links; labels use 1–32 characters. Opening a link follows Riscord’s confirmation flow. |
| Identity / artwork | Taken from the registered application. Arbitrary names, image URLs and bot tokens are not accepted. |
Clear and close
Use await rpc.clearActivity() in JavaScript or await rpc.clear_activity() in Python to remove the activity while keeping the connection. Use rpc.destroy() or await rpc.close() when your process is done.
A closed pipe removes only that connection’s activity. Native owner changes clear old connections; server leases expire after connection loss. Activity stays hidden while the user appears offline or limits their profile audience.
Connected Rich Presence takes priority over automatic game detection. When it clears or disconnects, automatic detection can show the current game again. Local activity is a claim from an application, not proof that a game is running. It grants no message, moderation or voice access.
Other languages
Probe the local Windows pipes \\.\pipe\riscord-ipc-0 through -7. Each frame has two little-endian unsigned 32-bit integers (opcode and JSON byte length), followed by at most 16 KiB of UTF-8 JSON.
Send opcode 0 with {"v":1,"client_id":"APPLICATION_ID"}. After the opcode 1 READY event, send opcode 1 with {"cmd":"SET_ACTIVITY","nonce":"unique-value","args":{"pid":YOUR_PROCESS_ID,"activity":{...}}}. Send activity:null to clear. The pipe checks your actual process ID.
Opcode 3 is PING, 4 is PONG, and 2 closes the connection. Keep a 30-second ping and close the pipe on shutdown. Unknown operations and invalid or oversized payloads end the connection. No network listener or login token is involved.