File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1919 postCategories : '' ,
2020 topicsOnly : ''
2121 } ,
22- regex : / h t t p s : \/ \/ d i s c o r d a p p .c o m \/ a p i \/ w e b h o o k s \/ ( [ 0 - 9 ] . + ?) \/ ( .+ ?) $ /
22+ regex : / h t t p s : \/ \/ d i s c o r d a p p \ .c o m \/ a p i \/ w e b h o o k s \/ ( [ 0 - 9 ] + ?) \/ ( .+ ?) $ /
2323 } ;
2424
2525 plugin . init = function ( params , callback ) {
3939
4040 // Parse Webhook URL (1: ID, 2: Token)
4141 var match = plugin . config [ 'webhookURL' ] . match ( plugin . regex ) ;
42- hook = new Discord . WebhookClient ( match [ 1 ] , match [ 2 ] ) ;
42+
43+ if ( match ) {
44+ hook = new Discord . WebhookClient ( match [ 1 ] , match [ 2 ] ) ;
45+ }
4346 } ) ;
4447
4548 callback ( ) ;
8184 . setFooter ( data . user . username , thumbnail )
8285 . setTimestamp ( ) ;
8386
84- hook . sendMessage ( '' , { embeds : [ embed ] } ) . catch ( console . error ) ;
87+ // Send notification:
88+ if ( hook ) {
89+ hook . sendMessage ( '' , { embeds : [ embed ] } ) . catch ( console . error ) ;
90+ }
8591 }
8692 } ) ;
8793 }
You can’t perform that action at this time.
0 commit comments