@ -36,25 +36,71 @@ module.exports = {
helpSorted [ category ] = categorySorted ;
}
let cat = await ask ( message , "What would you like help with? (`Fun`|`Utility`|`Misc`|`Moderation`|`Social`|`Leveling`) or `all` if you'd like to browse all commands" , 60000 ) ; if ( ! cat ) { return ; }
if ( ! [ 'f' , 'fun' , 'u' , 'util' , 'utility' , 'utilities' , 'm' , 'misc' , 'miscellaneous' , 'mod' , 'moderation' , 's' , 'social' , 'leveling' , 'l' , 'level' , 'a' , 'all' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { return message . channel . send ( "That wasn't a valid response! Try again?" ) ; }
let cle = await message . channel . send ( { embeds : [
new Discord . MessageEmbed ( )
. setTitle ( "Natsuki Help" )
. setDescription ( ` Here you can find a list of commands and how to use them. \n \n Natsuki's prefix, by default, is \` n? \` . Here, it's \` ${ prefix } \` . \n \n When viewing a command's syntax, a parameter/argument marked with <> means that it is required. [] shows that it is optional. \n \n Get more help on a command by sending it without any arguments (i.e. \` ${ prefix } anime \` ), or run \` ${ prefix } help <command> \` . ` )
. addField ( "Category" , "What category would you like to view?\n:one: - Fun\n:two: - Utility\n:three: - Misc\n:four: - Developer\n:five: - Moderation\n:six: - Social\n:seven: - Leveling\n:eight: - Anime\n:nine: - **All**" )
. setColor ( 'c375f0' )
. setFooter ( "Natsuki | Will time out in 60 seconds." )
. setThumbnail ( client . user . avatarURL ( { size : 2048 } ) )
. setTimestamp ( )
] } ) ;
let pages ;
if ( [ 'f' , 'fun' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Fun' ] ; }
if ( [ 'u' , 'util' , 'utility' , 'utilities' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Utility' ] ; }
if ( [ 'm' , 'misc' , 'miscellaneous' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Misc' ] ; }
if ( [ 'd' , 'dev' , 'developer' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Developer' ] ; }
if ( [ 'mod' , 'moderation' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Moderation' ] ; }
if ( [ 's' , 'social' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Social' ] ; }
if ( [ 'l' , 'leveling' , 'level' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Leveling' ] ; }
if ( [ 'a' , 'all' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = [ ] ; let c ; for ( c of Object . values ( helpSorted ) ) { let h ; for ( h of c ) { pages . push ( h ) } } }
let nums = {
'1️ ⃣ ' : "Fun" ,
'2️ ⃣ ' : "Utility" ,
'3️ ⃣ ' : "Misc" ,
'4️ ⃣ ' : "Developer" ,
'5️ ⃣ ' : "Moderation" ,
'6️ ⃣ ' : "Social" ,
'7️ ⃣ ' : "Leveling" ,
'8️ ⃣ ' : "Anime" ,
'9️ ⃣ ' : "All"
} ;
Object . keys ( nums ) . forEach ( num => cle . react ( num ) . catch ( ( ) => { } ) ) ;
let donePre = false ;
const getCat = ( ) => {
return new Promise ( r => {
message . channel . awaitMessages ( { filter : m => m . author . id === message . author . id , max : 1 , errors : [ 'time' ] , time : 60000 } ) . then ( cat => {
if ( donePre ) { return ; }
cat = cat . first ( ) . content ;
if ( [ 'f' , 'fun' , 'u' , 'util' , 'utility' , 'utilities' , 'm' , 'misc' , 'miscellaneous' , 'mod' , 'moderation' , 's' , 'social' , 'leveling' , 'l' , 'level' , 'ani' , 'anime' , 'a' , 'all' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) {
if ( [ 'f' , 'fun' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Fun' ] ; }
if ( [ 'u' , 'util' , 'utility' , 'utilities' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Utility' ] ; }
if ( [ 'm' , 'misc' , 'miscellaneous' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Misc' ] ; }
if ( [ 'd' , 'dev' , 'developer' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Developer' ] ; }
if ( [ 'mod' , 'moderation' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Moderation' ] ; }
if ( [ 's' , 'social' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Social' ] ; }
if ( [ 'l' , 'leveling' , 'level' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Leveling' ] ; }
if ( [ 'ani' , 'anime' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Anime' ] ; }
if ( [ 'a' , 'all' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = [ ] ; let c ; for ( c of Object . values ( helpSorted ) ) { let h ; for ( h of c ) { pages . push ( h ) } } }
donePre = true ;
r ( true ) ;
} else { donePre = true ; r ( false ) ; }
} ) . catch ( ( ) => { donePre = true ; r ( false ) ; } ) ;
cle . awaitReactions ( { filter : ( rt , u ) => Object . keys ( nums ) . includes ( rt . emoji . name ) && u . id === message . author . id , time : 60000 , errors : [ 'time' ] , max : 1 } ) . then ( collected => {
if ( donePre ) { return ; }
if ( nums [ collected . first ( ) . emoji . name ] === 'All' ) { pages = [ ] ; let c ; for ( c of Object . values ( helpSorted ) ) { let h ; for ( h of c ) { pages . push ( h ) } } }
else { pages = helpSorted [ nums [ collected . first ( ) . emoji . name ] ] ; }
donePre = true ;
r ( true ) ;
} ) . then ( ( ) => { donePre = true ; r ( false ) ; } ) ;
} ) ;
}
if ( ! await getCat ( ) . catch ( ( ) => { } ) ) { return ; }
await require ( '../../util/wait' ) ( 500 ) ;
cle . delete ( ) . catch ( ( ) => { } ) ;
if ( pages . length > 1 ) {
let help = new Pagination ( message . channel , pages , message , client , true ) ;
return await help . start ( { endTime : 120000 , user : message . author . id } ) ;
} else { return message . channel . send ( { embeds : [ pages [ 0 ] . setFooter ( "Natsuki" , client . user . avatarURL ( ) ) . setTimestamp ( ) ] } ) ; }
return await help . start ( { endTime : 6 0000, user : message . author . id } ) . catch ( ( ) => { } ) ;
} else { return message . channel . send ( { embeds : [ pages [ 0 ] . setFooter ( "Natsuki" , client . user . avatarURL ( ) ) . setTimestamp ( ) ] } ) . catch ( ( ) => { } ) ; }
} else {
let command ;
if ( client . commands . has ( args [ 0 ] ) ) { command = client . commands . get ( args [ 0 ] ) ; }