mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: more modular link preview generation
This commit is contained in:
@@ -28,9 +28,10 @@ export const getUrlInfo = async(
|
||||
try {
|
||||
const { getLinkPreview } = await import('link-preview-js')
|
||||
let previewLink = text
|
||||
if (!text.startsWith('https://') && !text.startsWith('http://')) {
|
||||
if(!text.startsWith('https://') && !text.startsWith('http://')) {
|
||||
previewLink = 'https://' + previewLink
|
||||
}
|
||||
|
||||
const info = await getLinkPreview(previewLink, { timeout: opts.timeoutMs })
|
||||
if(info && 'title' in info) {
|
||||
const [image] = info.images
|
||||
|
||||
Reference in New Issue
Block a user