File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -26,14 +26,20 @@ const DiscordTools = require('./discordTools.js');
26
26
const InstanceUtils = require ( '../util/instanceUtils.js' ) ;
27
27
const Timer = require ( '../util/timer' ) ;
28
28
29
+ function isValidUrl ( url ) {
30
+ if ( url . startsWith ( 'https' ) || url . startsWith ( 'http' ) ) return true ;
31
+ return false ;
32
+ }
33
+
29
34
module . exports = {
30
35
getEmbed : function ( options = { } ) {
31
36
const embed = new Discord . EmbedBuilder ( ) ;
32
37
33
38
if ( options . hasOwnProperty ( 'title' ) ) embed . setTitle ( options . title ) ;
34
39
if ( options . hasOwnProperty ( 'color' ) ) embed . setColor ( options . color ) ;
35
40
if ( options . hasOwnProperty ( 'description' ) ) embed . setDescription ( options . description ) ;
36
- if ( options . hasOwnProperty ( 'thumbnail' ) && options . thumbnail !== '' ) embed . setThumbnail ( options . thumbnail ) ;
41
+ if ( options . hasOwnProperty ( 'thumbnail' ) && options . thumbnail !== '' && isValidUrl ( options . thumbnail ) )
42
+ embed . setThumbnail ( options . thumbnail ) ;
37
43
if ( options . hasOwnProperty ( 'image' ) ) embed . setImage ( options . image ) ;
38
44
if ( options . hasOwnProperty ( 'url' ) && options . url !== '' ) embed . setURL ( options . url ) ;
39
45
if ( options . hasOwnProperty ( 'author' ) ) embed . setAuthor ( options . author ) ;
You can’t perform that action at this time.
0 commit comments