From cd187ee3cbda7bdaa8a066435c8fd905abb72f98 Mon Sep 17 00:00:00 2001 From: TheCodedProf Date: Fri, 27 Jan 2023 20:46:12 -0500 Subject: [PATCH] Finished Help, fixed command registration --- src/commands/help.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/commands/help.ts b/src/commands/help.ts index 7214799..c200e18 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -96,6 +96,21 @@ const callback = async (interaction: CommandInteraction): Promise => { descriptionLocalized?: string; })[] = []; //options + if(subcommandRow.components[0]!.options.find(option => option.data.default)) { + let Op = current.options.find(option => option.name === currentPath[1])! as ApplicationCommandSubGroup + let Op2 = Op.options!.find(option => option.name === currentPath[2])! + options = Op2.options || [] + } else if(subcommandGroupRow.components[0]!.options.find(option => option.data.default)) { + let Op = current.options.find(option => option.name === currentPath[1])! + if(Op.type === ApplicationCommandOptionType.SubcommandGroup) { + options = [] + } else { + Op = Op as ApplicationCommandSubCommand + options = Op.options || [] + } + } else { + options = current.options.filter(option => option.type !== ApplicationCommandOptionType.SubcommandGroup && option.type !== ApplicationCommandOptionType.Subcommand) || []; + } for(const option of options) { optionString += `> ${option.name} (${option.type})- ${option.description}\n` }