diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index ab2f182..843836a 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -100,11 +100,18 @@ function proxy(url) { if (!process.env.IMGPROXY_HOST) return url; + const auth = {}; + if (process.env.IMGPROXY_SALT && process.env.IMGPROXY_KEY) { + Object.assign(auth, { + salt: process.env.IMGPROXY_SALT, + key: process.env.IMGPROXY_KEY + }) + } + url = generateImageUrl({ endpoint: process.env.IMGPROXY_HOST, url: url, - salt: process.env.IMGPROXY_SALT, - key: process.env.IMGPROXY_KEY + ...auth }); return url; @@ -160,7 +167,7 @@ module.exports = { .setTitle(`Post #${post.id}`) .setURL(post.postView) .setDescription(description) - .setImage(post.fileUrl) + .setImage(proxy(post.fileUrl)) .setFooter({ text: footerText, iconURL: proxy(`https://${post.booru.domain}/favicon.ico`),