mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
starboard: also embed cdn.discordapp.com images
This commit is contained in:
parent
e2c57f8057
commit
4eacbeb889
1 changed files with 10 additions and 1 deletions
|
@ -301,7 +301,16 @@ export class StarboardPlugin extends ZeppelinPlugin {
|
||||||
} else if (msg.content) {
|
} else if (msg.content) {
|
||||||
const links = getUrlsInString(msg.content);
|
const links = getUrlsInString(msg.content);
|
||||||
for (const link of links) {
|
for (const link of links) {
|
||||||
if (link.hostname === "i.imgur.com") {
|
const parts = link
|
||||||
|
.toString()
|
||||||
|
.replace(/\/$/, "")
|
||||||
|
.split(".");
|
||||||
|
const ext = parts[parts.length - 1].toLowerCase();
|
||||||
|
|
||||||
|
if (
|
||||||
|
(link.hostname === "i.imgur.com" || link.hostname === "cdn.discordapp.com") &&
|
||||||
|
["jpeg", "jpg", "png", "gif", "webp"].includes(ext)
|
||||||
|
) {
|
||||||
embed.image = { url: link.toString() };
|
embed.image = { url: link.toString() };
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue