@ -36,10 +36,38 @@ module.exports = {
helpSorted [ category ] = categorySorted ;
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 ; }
let cle = await message . channel . send ( { embeds : [
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?" ) ; }
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 ;
let pages ;
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 ( [ 'f' , 'fun' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Fun' ] ; }
if ( [ 'u' , 'util' , 'utility' , 'utilities' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Utility' ] ; }
if ( [ 'u' , 'util' , 'utility' , 'utilities' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Utility' ] ; }
if ( [ 'm' , 'misc' , 'miscellaneous' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Misc' ] ; }
if ( [ 'm' , 'misc' , 'miscellaneous' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Misc' ] ; }
@ -47,14 +75,32 @@ module.exports = {
if ( [ 'mod' , 'moderation' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Moderation' ] ; }
if ( [ 'mod' , 'moderation' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Moderation' ] ; }
if ( [ 's' , 'social' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Social' ] ; }
if ( [ 's' , 'social' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Social' ] ; }
if ( [ 'l' , 'leveling' , 'level' ] . includes ( ` ${ cat } ` . trim ( ) . toLowerCase ( ) ) ) { pages = helpSorted [ 'Leveling' ] ; }
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 ) } } }
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 ) ;
await require ( '../../util/wait' ) ( 500 ) ;
cle . delete ( ) . catch ( ( ) => { } ) ;
if ( pages . length > 1 ) {
if ( pages . length > 1 ) {
let help = new Pagination ( message . channel , pages , message , client , true ) ;
let help = new Pagination ( message . channel , pages , message , client , true ) ;
return await help . start ( { endTime : 120000 , user : message . author . id } ) ;
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 ( ) ] } ) ; }
} else { return message . channel . send ( { embeds : [ pages [ 0 ] . setFooter ( "Natsuki" , client . user . avatarURL ( ) ) . setTimestamp ( ) ] } ) . catch ( ( ) => { } ) ; }
} else {
} else {
let command ;
let command ;
if ( client . commands . has ( args [ 0 ] ) ) { command = client . commands . get ( args [ 0 ] ) ; }
if ( client . commands . has ( args [ 0 ] ) ) { command = client . commands . get ( args [ 0 ] ) ; }