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');
2626const InstanceUtils = require ( '../util/instanceUtils.js' ) ;
2727const Timer = require ( '../util/timer' ) ;
2828
29+ function isValidUrl ( url ) {
30+ if ( url . startsWith ( 'https' ) || url . startsWith ( 'http' ) ) return true ;
31+ return false ;
32+ }
33+
2934module . exports = {
3035 getEmbed : function ( options = { } ) {
3136 const embed = new Discord . EmbedBuilder ( ) ;
3237
3338 if ( options . hasOwnProperty ( 'title' ) ) embed . setTitle ( options . title ) ;
3439 if ( options . hasOwnProperty ( 'color' ) ) embed . setColor ( options . color ) ;
3540 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 ) ;
3743 if ( options . hasOwnProperty ( 'image' ) ) embed . setImage ( options . image ) ;
3844 if ( options . hasOwnProperty ( 'url' ) && options . url !== '' ) embed . setURL ( options . url ) ;
3945 if ( options . hasOwnProperty ( 'author' ) ) embed . setAuthor ( options . author ) ;
You can’t perform that action at this time.
0 commit comments