Update WebEmbed.js
This commit is contained in:
parent
5953ec764e
commit
f8ce147a52
@ -11,6 +11,18 @@ class WebEmbed {
|
|||||||
this._setup(data);
|
this._setup(data);
|
||||||
}
|
}
|
||||||
_setup(data) {
|
_setup(data) {
|
||||||
|
/**
|
||||||
|
* Shorten the link
|
||||||
|
* @type {?boolean}
|
||||||
|
*/
|
||||||
|
this.shorten = data.shorten ?? false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hidden Embed link
|
||||||
|
* @type {?boolean}
|
||||||
|
*/
|
||||||
|
this.hidden = data.hidden ?? false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The title of this embed
|
* The title of this embed
|
||||||
* @type {?string}
|
* @type {?string}
|
||||||
@ -277,12 +289,12 @@ class WebEmbed {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const fullURL = `${baseURL}${arrayQuery.join('&')}`;
|
const fullURL = `${baseURL}${arrayQuery.join('&')}`;
|
||||||
if (shorten) {
|
if (this.shorten) {
|
||||||
const url = await getShorten(fullURL);
|
const url = await getShorten(fullURL);
|
||||||
if (!url) console.log('Cannot shorten URL in WebEmbed');
|
if (!url) console.log('Cannot shorten URL in WebEmbed');
|
||||||
return hidden ? `${hiddenCharter} ${url || fullURL}` : (url || fullURL);
|
return this.hidden ? `${hiddenCharter} ${url || fullURL}` : (url || fullURL);
|
||||||
} else {
|
} else {
|
||||||
return hidden ? `${hiddenCharter} ${fullURL}` : fullURL;
|
return this.hidden ? `${hiddenCharter} ${fullURL}` : fullURL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user