1- import { Message } from "../../types/message"
1+ import { Message } from "../../types/message" ;
22import log from "../components/utils/log" ;
33import { commands } from "../components/utils/cmd/loader" ;
44
55export const info = {
66 command : "help" ,
77 description : "List available commands and their usage." ,
8- usage : "help [page] | [role]" ,
9- example : "help admin " ,
8+ usage : "help [page] | [role] | [command] " ,
9+ example : "help" ,
1010 role : "user" ,
1111 cooldown : 5000 ,
1212} ;
@@ -26,10 +26,10 @@ function paginate(items: string[], page: number, pageSize: number): string[] {
2626function buildUserPage (
2727 userCommands : string [ ] ,
2828 page : number ,
29- totalPages : number
29+ totalPages : number ,
3030) : string {
3131 let response = `
32- Use \`help < command> \` for more details on a specific command.\n
32+ Use \`help [page] | [role] | [ command] \` for more details on a specific command.\n
3333 < ─────────── >\n • ${ userCommands . join ( "\n • " ) || "_None_" } \n\n` ;
3434 response += `< ─────────── >` ;
3535 response += `\n\`Page ${ page } of ${ totalPages } \`` ;
@@ -38,7 +38,7 @@ function buildUserPage(
3838
3939function buildAdminPage ( adminCommands : string [ ] ) : string {
4040 return `
41- Use \`help < command> \` for more details on a specific command.\n
41+ Use \`help [page] | [role] | [ command] \` for more details on a specific command.\n
4242 < ─────────── >\n • ${
4343 adminCommands . join ( "\n • " ) || "_None_"
4444 } \n< ─────────── >
@@ -79,6 +79,11 @@ export default async function (msg: Message) {
7979 return ;
8080 }
8181
82+ if ( ! / ^ [ 1 - 9 ] \d * $ / . test ( query ) ) {
83+ await msg . reply ( "Please type a valid page number." ) ;
84+ return ;
85+ }
86+
8287 // help [page]
8388 const match = query . match ( / ( \d + ) ? / i) ;
8489 const page = Math . max ( 1 , match && match [ 1 ] ? parseInt ( match [ 1 ] , 10 ) : 1 ) ;
0 commit comments