Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const EventEmitter = require('events');
const { setTimeout, clearTimeout } = require('timers');
const fetch = require('node-fetch');
const transports = require('./transports');
const { RPCCommands, RPCEvents, RelationshipTypes } = require('./constants');
const { RPCCommands, RPCEvents, RelationshipTypes, ActivityTypes } = require('./constants');
const { pid: getPid, uuid } = require('./util');

function subKey(event, args) {
Expand Down Expand Up @@ -472,6 +472,7 @@ class RPCClient extends EventEmitter {
let assets;
let party;
let secrets;
let type = ActivityTypes.PLAYING;
if (args.startTimestamp || args.endTimestamp) {
timestamps = {
start: args.startTimestamp,
Expand Down Expand Up @@ -514,11 +515,15 @@ class RPCClient extends EventEmitter {
spectate: args.spectateSecret,
};
}
if (args.type) {
type = args.type;
}

return this.request(RPCCommands.SET_ACTIVITY, {
pid,
activity: {
state: args.state,
type,
details: args.details,
timestamps,
assets,
Expand Down
7 changes: 7 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,10 @@ exports.RelationshipTypes = {
PENDING_OUTGOING: 4,
IMPLICIT: 5,
};

exports.ActivityTypes = {
PLAYING: 0,
LISTENING: 2,
WATCHING: 3,
COMPETING: 5,
}