2022-07-12 20:10:35 +03:00
const { modHelp } = require ( '../admin/moderation.js' ) ;
2022-09-27 16:45:50 -04:00
const { Constants } = require ( 'discord.js' ) ;
2022-09-06 15:29:48 -04:00
2022-08-17 12:09:40 -07:00
//CHANGE THIS TO FORMS?
2022-05-24 08:55:57 +03:00
module . exports = {
name : "help" ,
description : "Gets help for all of Selmer Bot's commands" ,
2022-09-27 16:45:50 -04:00
execute ( interaction , Discord , Client , bot ) {
2022-05-24 08:55:57 +03:00
2022-09-06 15:29:48 -04:00
const groups = new Map ( [ [ 'SBspec' , [ 'arrow' , 'extracredit' , 'profile' , 'quotes' , 'code' ] ] , [ 'adminCommands' , [ 'setup' , 'lock' , 'unlock' , 'serverlock' ] ] ] ) ;
2022-09-27 16:45:50 -04:00
var spec = "" ;
if ( interaction . options . data [ 0 ] ) {
spec = interaction . options . data [ 0 ] . value ;
}
2022-07-12 20:10:35 +03:00
2022-09-27 16:45:50 -04:00
if ( spec == 'econ' ) {
2022-05-24 08:55:57 +03:00
let temp = "***Selmer Bot Commands (Econ):***\n" ;
temp += bot . commands . get ( 'econ' ) . econHelp ( ) ;
2022-12-26 14:40:50 -08:00
temp += ` \n \n (remember to use \` / \` before the command!) ` ;
2022-09-27 16:45:50 -04:00
return interaction . reply ( { content : temp , ephemeral : true } ) ;
2022-07-12 20:10:35 +03:00
2022-05-25 22:33:42 +03:00
}
2022-09-27 16:45:50 -04:00
else if ( spec == 'game' ) {
2022-05-24 08:55:57 +03:00
let temp = "***Selmer Bot Commands (Games):***\n" ;
2022-05-25 22:33:42 +03:00
temp += bot . commands . get ( 'game' ) . allGames . join ( ", " ) ;
2022-12-26 14:40:50 -08:00
// temp += `\n\n_Note: due to how complicated this feature is, it will not be migrated to slash commands for now_`;
temp += ` \n \n (remember to use \' / \' before the command!) ` ;
2022-09-27 16:45:50 -04:00
return interaction . reply ( { content : temp , ephemeral : true } ) ;
2022-07-12 20:10:35 +03:00
}
2022-09-27 16:45:50 -04:00
else if ( spec == 'admin' ) {
2022-07-12 20:10:35 +03:00
let temp = ` __**Selmer Bot Admin Commands**__ \n `
Array . from ( groups . get ( 'adminCommands' ) ) . forEach ( commName => {
let comm = bot . commands . get ( commName ) ;
temp += ` ${ comm . name . toLowerCase ( ) } - _ ${ comm . description } _ \n ` ;
} ) ;
temp += ` __**Selmer Bot Moderation Commands**__ \n `
temp += modHelp ( ) ;
//Uses a different format, only the server owner can use it
2022-12-26 14:40:50 -08:00
temp += '\n_setup_ - ***SERVER OWNER ONLY*** - use \`setup help\`\n' ;
temp += ` \n \n (remember to use \` / \` before the command!) ` ;
2022-07-12 20:10:35 +03:00
2022-09-27 16:45:50 -04:00
return interaction . reply ( { content : temp , ephemeral : true } ) ;
2022-05-25 22:33:42 +03:00
}
2022-05-24 08:55:57 +03:00
let temp = "***Selmer Bot Commands:***\n" ;
2022-06-12 16:47:06 +03:00
bot . commands . sort ( ( a , b ) => { if ( a . name && b . name ) { return a . name [ 0 ] < b . name [ 0 ] } else { return false ; } } ) ;
2022-05-24 08:55:57 +03:00
2022-07-12 20:10:35 +03:00
const noPostList = Array . from ( groups . values ( ) ) . flat ( ) ;
const sList = groups . get ( 'SBspec' ) ;
bot . commands . forEach ( ( comm ) => {
2022-05-24 08:55:57 +03:00
if ( comm . name != 'verify' ) {
if ( comm . name == 'econ' ) {
2022-12-26 14:40:50 -08:00
temp += ` **econ** - use \` /help econ \` \n ` ;
2022-05-25 22:33:42 +03:00
}
else if ( comm . name == 'game' ) {
2022-12-26 14:40:50 -08:00
temp += ` **games** - use \` /help game \` \n ` ;
2022-07-12 20:10:35 +03:00
}
2022-05-25 22:33:42 +03:00
else {
2022-07-12 20:10:35 +03:00
if ( comm . name && comm . description && ! noPostList . includes ( comm . name ) ) {
2022-06-12 16:47:06 +03:00
temp += ` ${ comm . name . toLowerCase ( ) } - _ ${ comm . description } _ \n ` ;
}
2022-05-24 08:55:57 +03:00
}
}
} ) ;
2022-12-26 14:40:50 -08:00
temp += '**admin/moderation commands** - use `/help admin`\n' ;
2022-07-09 20:30:31 +03:00
2022-07-12 20:10:35 +03:00
//Selmer Specific
temp += '\n__**Selmer\'s \\*Special\\* Commands**__\n'
sList . forEach ( ( commName ) => {
const comm = bot . commands . get ( commName ) ;
2022-12-26 14:40:50 -08:00
if ( comm && comm . name && comm . description ) {
temp += ` ${ comm . name . toLowerCase ( ) } - _ ${ comm . description } _ \n ` ;
}
2022-07-12 20:10:35 +03:00
} )
2022-12-26 14:40:50 -08:00
temp += ` \n _(remember to use \` / \` before the command!)_ ` ;
2022-07-12 20:10:35 +03:00
2022-09-27 16:45:50 -04:00
interaction . reply ( { content : temp , ephemeral : true } ) ;
} ,
options : [ { name : 'command' , description : 'econ, game, or admin' , type : Constants . ApplicationCommandOptionTypes . STRING , required : false , choices : [ { name : 'econ' , value : 'econ' } , { name : 'game' , value : 'game' } , { name : 'admin' , value : 'admin' } ] } ]
2022-05-24 08:55:57 +03:00
}