Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Activity): add missing fields #4984

Merged
merged 8 commits into from Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/structures/Presence.js
Expand Up @@ -138,6 +138,13 @@ class Presence {
}
}

/**
* The platform of this activity:
* * **`xbox`** - playing on Xbox Live
* * **`samsung`** - playing on Samsung Galaxy
* @typedef {string} ActivityPlatform
*/

/**
* Represents an activity that is part of a user's presence.
*/
Expand All @@ -146,7 +153,13 @@ class Activity {
Object.defineProperty(this, 'presence', { value: presence });

/**
* The name of the activity being played
* The ID of the activity
* @type {string}
*/
this.id = data.id;

/**
* The name of the activity
* @type {string}
*/
this.name = data.name;
Expand Down Expand Up @@ -194,6 +207,12 @@ class Activity {
}
: null;

/**
* The platform the game is being played on
* @type {?ActivityPlatform}
*/
this.platform = data.platform || null;
advaith1 marked this conversation as resolved.
Show resolved Hide resolved

/**
* Party of the activity
* @type {?Object}
Expand Down
4 changes: 4 additions & 0 deletions typings/index.d.ts
Expand Up @@ -21,6 +21,8 @@ declare module 'discord.js' {

//#region Classes

type ActivityPlatform = 'xbox' | 'samsung';
advaith1 marked this conversation as resolved.
Show resolved Hide resolved

export class Activity {
constructor(presence: Presence, data?: object);
public applicationID: Snowflake | null;
Expand All @@ -30,11 +32,13 @@ declare module 'discord.js' {
public details: string | null;
public emoji: Emoji | null;
public flags: Readonly<ActivityFlags>;
public id: string;
public name: string;
public party: {
id: string | null;
size: [number, number];
} | null;
public platform: ActivityPlatform;
advaith1 marked this conversation as resolved.
Show resolved Hide resolved
public state: string | null;
public timestamps: {
start: Date | null;
Expand Down