Skip to content

Commit

Permalink
Update client.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Nubuki-all authored Dec 17, 2024
1 parent fb208f7 commit 01126b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions neonize/aioze/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
from .events import Event
from ..utils.log import log
from concurrent.futures import ThreadPoolExecutor
from linkpreview import link_preview as fallback_link_preview

loop = get_event_loop()

Expand Down Expand Up @@ -471,6 +472,8 @@ async def _generate_link_preview(self, text: str) -> ExtendedTextMessage | None:
valid_links = list(filter(validate_link, links))
if valid_links:
preview = await link_preview(valid_links[0])
if not preview:
preview = fallback_link_preview(valid_links[0])
preview_type = (
ExtendedTextMessage.PreviewType.VIDEO
if re.match(youtube_url_pattern, valid_links[0])
Expand Down

0 comments on commit 01126b0

Please sign in to comment.