Downgrade to v13
[vi] cảm giác đau khổ
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
const Base = require('./Base');
|
||||
const { Emoji } = require('./Emoji');
|
||||
const ActivityFlagsBitField = require('../util/ActivityFlagsBitField');
|
||||
const ActivityFlags = require('../util/ActivityFlags');
|
||||
const { ActivityTypes } = require('../util/Constants');
|
||||
const Util = require('../util/Util');
|
||||
|
||||
/**
|
||||
@@ -167,7 +168,7 @@ class Activity {
|
||||
* The activity status's type
|
||||
* @type {ActivityType}
|
||||
*/
|
||||
this.type = data.type;
|
||||
this.type = typeof data.type === 'number' ? ActivityTypes[data.type] : data.type;
|
||||
|
||||
/**
|
||||
* If the activity is being streamed, a link to the stream
|
||||
@@ -244,9 +245,9 @@ class Activity {
|
||||
|
||||
/**
|
||||
* Flags that describe the activity
|
||||
* @type {Readonly<ActivityFlagsBitField>}
|
||||
* @type {Readonly<ActivityFlags>}
|
||||
*/
|
||||
this.flags = new ActivityFlagsBitField(data.flags).freeze();
|
||||
this.flags = new ActivityFlags(data.flags).freeze();
|
||||
|
||||
/**
|
||||
* Emoji for a custom activity
|
||||
@@ -270,7 +271,7 @@ class Activity {
|
||||
* Creation date of the activity
|
||||
* @type {number}
|
||||
*/
|
||||
this.createdTimestamp = Date.parse(data.created_at);
|
||||
this.createdTimestamp = new Date(data.created_at).getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,48 +347,35 @@ class RichPresenceAssets {
|
||||
|
||||
/**
|
||||
* Gets the URL of the small image asset
|
||||
* @param {ImageURLOptions} [options={}] Options for the image URL
|
||||
* @param {StaticImageURLOptions} [options] Options for the image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
smallImageURL(options = {}) {
|
||||
if (!this.smallImage) return null;
|
||||
if (this.smallImage.includes(':')) {
|
||||
const [platform, id] = this.smallImage.split(':');
|
||||
switch (platform) {
|
||||
case 'mp':
|
||||
return `https://media.discordapp.net/${id}`;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return this.activity.presence.client.rest.cdn.appAsset(this.activity.applicationId, this.smallImage, options);
|
||||
smallImageURL({ format, size } = {}) {
|
||||
return (
|
||||
this.smallImage &&
|
||||
this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationId, this.smallImage, {
|
||||
format,
|
||||
size,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL of the large image asset
|
||||
* @param {ImageURLOptions} [options={}] Options for the image URL
|
||||
* @param {StaticImageURLOptions} [options] Options for the image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
largeImageURL(options = {}) {
|
||||
largeImageURL({ format, size } = {}) {
|
||||
if (!this.largeImage) return null;
|
||||
if (this.largeImage.includes(':')) {
|
||||
const [platform, id] = this.largeImage.split(':');
|
||||
switch (platform) {
|
||||
case 'mp':
|
||||
return `https://media.discordapp.net/${id}`;
|
||||
case 'spotify':
|
||||
return `https://i.scdn.co/image/${id}`;
|
||||
case 'youtube':
|
||||
return `https://i.ytimg.com/vi/${id}/hqdefault_live.jpg`;
|
||||
case 'twitch':
|
||||
return `https://static-cdn.jtvnw.net/previews-ttv/live_user_${id}.png`;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
if (/^spotify:/.test(this.largeImage)) {
|
||||
return `https://i.scdn.co/image/${this.largeImage.slice(8)}`;
|
||||
} else if (/^twitch:/.test(this.largeImage)) {
|
||||
return `https://static-cdn.jtvnw.net/previews-ttv/live_user_${this.largeImage.slice(7)}.png`;
|
||||
}
|
||||
|
||||
return this.activity.presence.client.rest.cdn.appAsset(this.activity.applicationId, this.largeImage, options);
|
||||
return this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationId, this.largeImage, {
|
||||
format,
|
||||
size,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user