2018-09-09 01:17:11 +02:00
const { Command } = require ( 'discord.js-commando' ) ;
2018-09-20 17:50:28 +02:00
const responseObject = require ( "../../json/funfact.json" ) ;
2018-10-15 20:23:45 +02:00
const blacklist = require ( '../../json/blacklist.json' )
2018-09-09 01:17:11 +02:00
module . exports = class FunFactCommand extends Command {
constructor ( client ) {
super ( client , {
name : 'funfact' ,
group : 'fun' ,
memberName : 'funfact' ,
2018-09-09 20:07:28 +02:00
description : ` Send some fun fact. If you would like to see some of yours fun fact you can send them to @Supositware | Baguette#8211. There is currently ** ${ Object . keys ( responseObject ) . length } ** fun fact. ` ,
2018-09-09 01:17:11 +02:00
} ) ;
}
2018-09-09 21:32:08 +02:00
async run ( message ) {
2018-10-15 20:23:45 +02:00
if ( blacklist [ message . author . id ] )
return message . channel . send ( "You are blacklisted" )
2018-09-09 20:07:28 +02:00
const number = Object . keys ( responseObject ) . length ;
2018-09-09 01:17:11 +02:00
const funFactNumber = Math . floor ( Math . random ( ) * ( number - 1 + 1 ) ) + 1 ;
message . channel . send ( ` Fun fact: ${ responseObject [ funFactNumber ] } ` ) ;
}
} ;