From f8ce147a52acaf44006a10c71f343926e3664406 Mon Sep 17 00:00:00 2001 From: John Marlo Date: Fri, 1 Apr 2022 16:41:06 +0800 Subject: [PATCH] Update WebEmbed.js --- src/structures/WebEmbed.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/structures/WebEmbed.js b/src/structures/WebEmbed.js index 1f71e3c..4028817 100644 --- a/src/structures/WebEmbed.js +++ b/src/structures/WebEmbed.js @@ -11,6 +11,18 @@ class WebEmbed { this._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 * @type {?string} @@ -277,12 +289,12 @@ class WebEmbed { ); } const fullURL = `${baseURL}${arrayQuery.join('&')}`; - if (shorten) { + if (this.shorten) { const url = await getShorten(fullURL); 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 { - return hidden ? `${hiddenCharter} ${fullURL}` : fullURL; + return this.hidden ? `${hiddenCharter} ${fullURL}` : fullURL; } } } @@ -301,4 +313,4 @@ const getShorten = async (url) => { } } -module.exports = WebEmbed; \ No newline at end of file +module.exports = WebEmbed;