From d19826f1e1f29f068dfae17b24729f07e8b8d417 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Wed, 16 Jul 2025 16:06:52 -0600 Subject: [PATCH] userinfo: thanks cdn for not liking // in path --- src/modules/utility/userinfo.js | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/modules/utility/userinfo.js b/src/modules/utility/userinfo.js index 30944e9..0066a82 100644 --- a/src/modules/utility/userinfo.js +++ b/src/modules/utility/userinfo.js @@ -509,31 +509,31 @@ userinfo.callback = async function (msg, line) { .catch(() => {}); const baseUrl = `https://cdn.discordapp.com/assets/collectibles/${nameplate.asset}`; - let imageUrl = baseUrl + "/static.png"; + let imageUrl = baseUrl + "static.png"; if (palette) { - //try { - const static = await fetch(imageUrl) - .then((res) => res.arrayBuffer()) - .then((b) => Buffer.from(b)); + try { + const static = await fetch(imageUrl) + .then((res) => res.arrayBuffer()) + .then((b) => Buffer.from(b)); - const bg_light = nameplateBackground(palette.lightBackground); - bg_light.composite([{input: static}]); - const bg_dark = nameplateBackground(palette.darkBackground); - bg_dark.composite([{input: static}]); + const bg_light = nameplateBackground(palette.lightBackground); + bg_light.composite([{input: static}]); + const bg_dark = nameplateBackground(palette.darkBackground); + bg_dark.composite([{input: static}]); - const final = sharp({create: {width: 448, height: 168, channels: 4, background: "transparent"}}); - final.composite([ - {input: await bg_light.toBuffer(), gravity: "north"}, - {input: await bg_dark.toBuffer(), gravity: "south"}, - ]); - attachments.push({ - file: await final.png().toBuffer(), - filename: "nameplate.png", - }); - imageUrl = "attachment://nameplate.png"; - //} catch { - // noop - //} + const final = sharp({create: {width: 448, height: 168, channels: 4, background: "transparent"}}); + final.composite([ + {input: await bg_light.toBuffer(), gravity: "north"}, + {input: await bg_dark.toBuffer(), gravity: "south"}, + ]); + attachments.push({ + file: await final.png().toBuffer(), + filename: "nameplate.png", + }); + imageUrl = "attachment://nameplate.png"; + } catch { + // noop + } } nameplateEmbed = { @@ -547,7 +547,7 @@ userinfo.callback = async function (msg, line) { {name: "Dark Background", value: palette?.darkBackground ?? "*Unknown*", inline: true}, { name: "\u200b", - value: `[PNG](${baseUrl}/static.png)\u3000[WebM](${baseUrl}/asset.webm)\u3000[APNG](${baseUrl}/img.png)`, + value: `[PNG](${baseUrl}static.png)\u3000[WebM](${baseUrl}asset.webm)\u3000[APNG](${baseUrl}img.png)`, inline: false, }, ],