const { InteractionContextType, SlashCommandBuilder } = require('discord.js'); // Every command needs a Dragonroll campaign, and campaigns are linked to // Discord servers, so none of them make sense in a DM. const guildOnly = (command) => command.setContexts(InteractionContextType.Guild); const commands = [ guildOnly(new SlashCommandBuilder() .setName('characters') .setDescription('List the characters of the Dragonroll campaign linked to this server.') .addStringOption((option) => option .setName('type') .setDescription('Filter by actor type.') .addChoices( { name: 'All', value: 'all' }, { name: 'Characters', value: 'character' }, { name: 'NPCs', value: 'npc' }, { name: 'Creatures', value: 'creature' } ))), guildOnly(new SlashCommandBuilder() .setName('character') .setDescription('Consult a character sheet from the Dragonroll campaign linked to this server.') .addStringOption((option) => option .setName('name') .setDescription('Character name (full or partial).') .setRequired(true) .setMaxLength(100) .setAutocomplete(true)) .addBooleanOption((option) => option .setName('public') .setDescription('Show the character sheet to everyone in this channel.'))), guildOnly(new SlashCommandBuilder() .setName('dragonroll') .setDescription('Configure or check this server’s Dragonroll campaign.') .addSubcommand((subcommand) => subcommand .setName('connect') .setDescription('Connect your Dragonroll account to this server.')) .addSubcommand((subcommand) => subcommand .setName('link') .setDescription('Choose a campaign owned by the connected Dragonroll account.') .addStringOption((option) => option .setName('campaign') .setDescription('Campaign to use in this server.') .setRequired(true) .setAutocomplete(true))) .addSubcommand((subcommand) => subcommand .setName('unlink') .setDescription('Remove this server’s Dragonroll campaign link.')) .addSubcommand((subcommand) => subcommand .setName('status') .setDescription('Show the campaign linked to this server.')) .addSubcommand((subcommand) => subcommand .setName('refresh') .setDescription('Refresh this server’s Dragonroll connection status.'))) ]; module.exports = commands;