From e75b7e64b9a47a6a184f14adc63fa774aab7e6b8 Mon Sep 17 00:00:00 2001 From: Rnbsov Date: Fri, 15 Mar 2024 21:40:20 +0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=83=20Remove=20unnecessary=20find=20me?= =?UTF-8?q?thods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/getUrlAndLabels.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/getUrlAndLabels.ts b/src/utils/getUrlAndLabels.ts index 356d293..37d9658 100644 --- a/src/utils/getUrlAndLabels.ts +++ b/src/utils/getUrlAndLabels.ts @@ -22,14 +22,14 @@ export function getUrlAndLabels(ctx: Filter) ;({ url, labels } = parseUrls(message)[0]) } else if (ctx.entities('text_link').length > 0) { // handle case when user sends a message with text formatted link - const linkEntity = ctx.entities('text_link').find((entity) => entity.type === 'text_link') + const linkEntity = ctx.entities('text_link')[0] if (linkEntity && linkEntity.url) { url = linkEntity.url } labels = [] } else { // retrieve the first url from the message/post - const urlEntity = ctx.entities('url').find((entity) => entity.type === 'url') + const urlEntity = ctx.entities('url')[0] if (urlEntity && urlEntity.text) { url = urlEntity.text }