diff --git a/main.mjs b/main.mjs index 912af4e..0aed906 100644 --- a/main.mjs +++ b/main.mjs @@ -57,8 +57,8 @@ function getMessageUrl(msg) { } function getTextLink(msg) { - const textLinks = (msg.entities ?? []).filter(isTextLink); - return textLinks.length ? textLinks[0].url : null; + const textLink = (msg.entities ?? []).find(isTextLink); + return textLink ? textLink.url : null; } function isTextLink(msgEntity) {