From cab7d97150670b6e32f4d1718bc5c992f1135a98 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Fri, 11 Mar 2022 12:10:18 +0000 Subject: [PATCH] Revert "feat: Add custom image support to version 13 (#7557)" This reverts commit 679b87c4f88a7bd56bf81a9ade0fc2bf7e54495a. --- src/structures/Presence.js | 41 ++++++++++---------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/src/structures/Presence.js b/src/structures/Presence.js index 744450f7e5c2..ce7620b4692d 100644 --- a/src/structures/Presence.js +++ b/src/structures/Presence.js @@ -351,21 +351,13 @@ class RichPresenceAssets { * @returns {?string} */ smallImageURL({ 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, - }); + return ( + this.smallImage && + this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationId, this.smallImage, { + format, + size, + }) + ); } /** @@ -375,22 +367,11 @@ class RichPresenceAssets { */ 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, { format, size,