diff --git a/src/commands/general/help.ts b/src/commands/general/help.ts index 0ee5ce5..bca7b10 100644 --- a/src/commands/general/help.ts +++ b/src/commands/general/help.ts @@ -15,6 +15,7 @@ * along with ArgonBot. If not, see . */ import Command from '@structures/command'; +import { capitalize } from '@utils/utils'; import config from 'config'; import { Client, Message, MessageButton, MessageEmbed, MessageSelectMenu, MessageSelectOptionData } from 'discord.js'; import i18next from 'i18next'; @@ -24,6 +25,7 @@ export default class extends Command { super(client, file, { shortDescription: i18next.t('commands:help.shortDescription'), extendedDescription: i18next.t('commands:help.extendedDescription'), + usage: 'vm', args: [ { name: 'command', @@ -58,7 +60,7 @@ export default class extends Command { commandGroups.forEach((val, index) => { val.embed = new MessageEmbed(); val.embed.setAuthor(i18next.t('commands:help.embedName')); - val.embed.setTitle(val.name.toUpperCase()); + val.embed.setTitle(capitalize(val.name)); val.embed.setColor(message.member?.roles.highest.color ?? 0xFFFFFF); val.embed.setFooter(`Page ${index + 1}/${commandGroups.length}`); val.embed.setTimestamp(); @@ -87,7 +89,7 @@ export default class extends Command { chooseHelpCategory.setPlaceholder(i18next.t('commands:help.categoryPlaceholder')); for(const category of categories) { - dropDownOptions.push({ label: category, value: category }); + dropDownOptions.push({ label: capitalize(category), value: category }); } chooseHelpCategory.addOptions(dropDownOptions); @@ -109,7 +111,7 @@ export default class extends Command { previousCategoryBtn.setDisabled(false); } - if(currentPage !== 0) { + if(currentPage + 1 !== commandGroups.length) { nextCategoryBtn.setDisabled(false); previousCategoryBtn.setDisabled(true); } @@ -127,7 +129,7 @@ export default class extends Command { nextCategoryBtn.setDisabled(false); } - if(currentPage !== 0) { + if(currentPage + 1 !== commandGroups.length) { nextCategoryBtn.setDisabled(false); previousCategoryBtn.setDisabled(true); } @@ -145,7 +147,7 @@ export default class extends Command { nextCategoryBtn.setDisabled(false); } - if(currentPage !== 0) { + if(currentPage + 1 !== commandGroups.length) { nextCategoryBtn.setDisabled(false); previousCategoryBtn.setDisabled(true); } @@ -178,12 +180,13 @@ export default class extends Command { if(findCommand) { const commandEmbed = new MessageEmbed(); commandEmbed.setAuthor(i18next.t('commands:help.embedName')); - commandEmbed.setTitle(findCommand.options.name!.toUpperCase()); + commandEmbed.setTitle(capitalize(findCommand.options.name!)); commandEmbed.setColor(message.member?.roles.highest.color ?? 0xFFFFFF); commandEmbed.setTimestamp(); commandEmbed.setDescription(i18next.t('commands:help.commandDescription', { name: findCommand.options.name, + category: capitalize(findCommand.options.group!), description: findCommand.options.extendedDescription ?? i18next.t('commands:generic.noExtendedDescription'), usage: findCommand.options.usage ? `!${findCommand.options.name} ${findCommand.options.usage}` : i18next.t('commands:generic.noUsage'), })); diff --git a/src/commands/utils/vm.ts b/src/commands/utils/vm.ts index e72d9f2..42fbdf1 100644 --- a/src/commands/utils/vm.ts +++ b/src/commands/utils/vm.ts @@ -15,7 +15,6 @@ * along with ArgonBot. If not, see . */ import Command from '@structures/command'; - import type { Client, Message } from 'discord.js'; import i18next from 'i18next'; import { transpile } from 'typescript'; @@ -26,6 +25,7 @@ export default class extends Command { super(client, file, { shortDescription: i18next.t('commands:vm.shortDescription'), extendedDescription: i18next.t('commands:vm.extendedDescription'), + usage: 'js const test = \'test\'; return test;', args: [ { name: 'language', diff --git a/src/lib/utils/utils.ts b/src/lib/utils/utils.ts index 2a2feae..82ac94e 100644 --- a/src/lib/utils/utils.ts +++ b/src/lib/utils/utils.ts @@ -53,3 +53,7 @@ export const walkDir = async (dir: string): Promise => { }); }); }; + +export const capitalize = (string: string): string => { + return string.charAt(0).toUpperCase() + string.slice(1); +};