feat(Activity): support for CUSTOM_STATUS activity type (#3353)

* feat: support for custom status in activity

* nit(typings): order properties
This commit is contained in:
Jeroen Claassens
2019-12-05 13:13:42 +01:00
committed by SpaceEEC
parent 1b1289b35e
commit 2ca74d6b63
3 changed files with 29 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
const Util = require('../util/Util');
const ActivityFlags = require('../util/ActivityFlags');
const { ActivityTypes } = require('../util/Constants');
const Emoji = require('./Emoji');
/**
* Activity sent in a message.
@@ -205,6 +206,18 @@ class Activity {
* @type {Readonly<ActivityFlags>}
*/
this.flags = new ActivityFlags(data.flags).freeze();
/**
* Emoji for a custom activity
* @type {?Emoji}
*/
this.emoji = data.emoji ? new Emoji(presence.client, data.emoji) : null;
/**
* Creation date of the activity
* @type {number}
*/
this.createdTimestamp = new Date(data.created_at).getTime();
}
/**
@@ -221,6 +234,15 @@ class Activity {
);
}
/**
* The time the activity was created at
* @type {Date}
* @readonly
*/
get createdAt() {
return new Date(this.createdTimestamp);
}
/**
* When concatenated with a string, this automatically returns the activities' name instead of the Activity object.
* @returns {string}