Discord.js v13.7

This commit is contained in:
March 7th
2022-05-14 15:06:15 +07:00
parent fc7f02e85b
commit c201e7da69
83 changed files with 4232 additions and 1162 deletions

View File

@@ -351,13 +351,21 @@ class RichPresenceAssets {
* @returns {?string}
*/
smallImageURL({ format, size } = {}) {
return (
this.smallImage &&
this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationId, this.smallImage, {
format,
size,
})
);
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, {
format,
size,
});
}
/**
@@ -367,11 +375,20 @@ class RichPresenceAssets {
*/
largeImageURL({ format, size } = {}) {
if (!this.largeImage) 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`;
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 'twitch':
return `https://static-cdn.jtvnw.net/previews-ttv/live_user_${id}.png`;
default:
return null;
}
}
return this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationId, this.largeImage, {
format,
size,