diff --git a/src/structures/Presence.js b/src/structures/Presence.js index ce7620b4692d..744450f7e5c2 100644 --- a/src/structures/Presence.js +++ b/src/structures/Presence.js @@ -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,22 @@ 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 '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; + } } + return this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationId, this.largeImage, { format, size,