@ -49,10 +49,9 @@ module.exports = {
if ( ` ${ response } ` . length > 300 ) { return message . channel . send ( "Your response needs to be less than 300 characters, please!" ) ; }
if ( ` ${ response } ` . length > 300 ) { return message . channel . send ( "Your response needs to be less than 300 characters, please!" ) ; }
let tar = await AR . findOne ( { gid : message . guild . id } ) || new AR ( { gid : message . guild . id } ) ;
let tar = await AR . findOne ( { gid : message . guild . id } ) || new AR ( { gid : message . guild . id } ) ;
if ( tar . triggers . length === 20 ) { return message . channel . send ( "Because of data storage concerns, your ARs are capped at 20 per server. You can join the official support server and talk to the devs if you have a legitimate reason for raising this limit and they can see about raising it for you!" ) ; }
let h = false ; let ar ; for ( ar of tar . triggers ) { if ( ar && ar . toLowerCase ( ) === ` ${ trigger } ` . toLowerCase ( ) ) { h = true ; } }
let h = false ; let ar ; for ( ar of tar . triggers ) { if ( ar && ar . toLowerCase ( ) === ` ${ trigger } ` . toLowerCase ( ) ) { h = true ; } }
if ( h ) { return message . channel . send ( "You seem to already have that trigger. Try using `edit` instead!" ) ; }
if ( h ) { return message . channel . send ( "You seem to already have that trigger. Try using `edit` instead!" ) ; }
tar . triggers . push ( trigger ) ;
tar . triggers . push ( trigger . toLowerCase ( ) ) ;
client . misc . cache . ar . set ( message . guild . id , tar . triggers ) ;
client . misc . cache . ar . set ( message . guild . id , tar . triggers ) ;
tar . ars . push ( response ) ;
tar . ars . push ( response ) ;
tar . save ( ) ;
tar . save ( ) ;