Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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: type,
details: args.details,
timestamps,
assets,
Expand Down
9 changes: 9 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,12 @@ exports.RelationshipTypes = {
PENDING_OUTGOING: 4,
IMPLICIT: 5,
};

exports.ActivityTypes = {
PLAYING: 0,
STREAMING: 1,
LISTENING: 2,
WATCHING: 3,
CUSTOM: 4,
COMPETING: 5
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exports.ActivityTypes = {
PLAYING: 0,
STREAMING: 1,
LISTENING: 2,
WATCHING: 3,
CUSTOM: 4,
COMPETING: 5
}
exports.ActivityTypes = {
PLAYING: 0,
WATCHING: 3
}

Only PLAYING and WATCHING are allowed by RPC. Everything else results in an error.