import { addCommand, CommandGenerator, CommandOptionGenerator, OptionChoices } from 'discordslash'; import { InteractionRoles } from './data'; import Lang from 'lang'; import { RolesAllCommand, RolesCommand } from './commands'; export function initSlash() { const Categories: OptionChoices[] = InteractionRoles.map(opt => ({ name: opt.message, value: opt.id })); addCommand([ //roles ====== new CommandGenerator() .setName('roles') .setDescription(Lang.get('command.roles.description.command')) .addOption([ new CommandOptionGenerator() .setName('category') .setType('string') .setDescription(Lang.get('commands.roles.categorydescription.category')) .addChoice(Categories) .setRequired() ]) .setRun(RolesCommand), //rolesall ====== new CommandGenerator() .setName('rolesall') .setDescription(Lang.get('command.rolesall.description.command')) .addOption([ new CommandOptionGenerator() .setName('category') .setType('string') .setDescription(Lang.get('command.rolesall.description.category')) .addChoice(Categories), new CommandOptionGenerator() .setName('channel') .setType('channel') .setDescription(Lang.get('command.rolesall.description.command')) ]) .setRun(RolesAllCommand) ]); }