diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-17 21:05:31 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-17 21:05:31 +1000 |
commit | 9733926bf76b3dba45caa5add16e9792b1ddd145 (patch) | |
tree | fd38c0b52f4bd871ffdb3166b362ac6716046222 | |
parent | Redirect guild profile cdn stuff to normal avatar route while guild profiles ... (diff) | |
parent | Message embeds use image width/height (diff) | |
download | server-9733926bf76b3dba45caa5add16e9792b1ddd145.tar.xz |
Merge branch 'fix/messageLinkMetas' into slowcord
-rw-r--r-- | api/src/util/handlers/Message.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts index 48f87dfe..ed17995b 100644 --- a/api/src/util/handlers/Message.ts +++ b/api/src/util/handlers/Message.ts @@ -166,7 +166,11 @@ export async function postHandleMessage(message: Message) { const provider_name = $('meta[property="og:site_name"]').text(); const author_name = $('meta[property="article:author"]').attr("content"); const description = $('meta[property="og:description"]').attr("content") || $('meta[property="description"]').attr("content"); + const image = $('meta[property="og:image"]').attr("content"); + const width = parseInt($('meta[property="og:image:width"]').attr("content") || "") || undefined; + const height = parseInt($('meta[property="og:image:height"]').attr("content") || "") || undefined; + const url = $('meta[property="og:url"]').attr("content"); // TODO: color const embed: Embed = { @@ -177,7 +181,7 @@ export async function postHandleMessage(message: Message) { }; if (author_name) embed.author = { name: author_name }; - if (image) embed.thumbnail = { proxy_url: image, url: image }; + if (image) embed.thumbnail = { proxy_url: image, url: image, width: width, height: height }; if (title) embed.title = title; if (url) embed.url = url; if (description) embed.description = description; |