feat: Updated /help command to be dynamic

This commit is contained in:
Marius Begby committed 2023-07-23 14:55:53 +02:00
1 parent 6af04f7b5c
commit b95a652f1c
15 files changed
+87 -13

No files matched your search

+35 -2
View File
@@ -5,8 +5,40 @@ module.exports = {
data: new SlashCommandBuilder()
.setName('help')
.setDescription('Show a list of commands and their usage.')
.setDMPermission(false),
execute: async ({ interaction }) => {
.setDMPermission(false)
.setNSFW(false),
execute: async ({ interaction, client }) => {
const commandList = client.commands
.filter((command) => {
// don't include system commands
if (command.isSystemCommand) {
return false;
}
return true;
})
.map((command) => {
let params = command.data.options[0] ? `**\`${command.data.options[0].name}\`**` + ' ' : '';
let beta = command.isBeta ? `${embedOptions.icons.beta} ` : '';
let newCommand = command.isNew ? `${embedOptions.icons.new} ` : '';
return `- **\`/${command.data.name}\`** ${params}- ${beta}${newCommand}${command.data.description}`;
});
const commandListString = commandList.join('\n');
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(
`${embedOptions.icons.rule} **List of commands**\n` +
`${commandListString}\n\n` +
`${embedOptions.icons.support} **Support server**\nJoin the support server for help or suggestions: \n**${botOptions.serverInviteUrl}**\n\n` +
`${embedOptions.icons.bot} **Enjoying ${botOptions.name}?**\nAdd me to another server: \n**[Click me!](${botOptions.botInviteUrl})**`
)
.setColor(embedOptions.colors.info)
]
});
/*
return await interaction.editReply({
embeds: [
new EmbedBuilder()
@@ -30,5 +62,6 @@ module.exports = {
.setColor(embedOptions.colors.info)
]
});
*/
}
};