75 lines
3.5 KiB
JavaScript
75 lines
3.5 KiB
JavaScript
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.'))
|
||
.addSubcommand((subcommand) => subcommand
|
||
.setName('assign')
|
||
.setDescription('Link one character of the campaign to your Discord account.')
|
||
.addStringOption((option) => option
|
||
.setName('character')
|
||
.setDescription('Character to play (pick it from the campaign roster).')
|
||
.setRequired(true)
|
||
.setMaxLength(100)
|
||
.setAutocomplete(true)))
|
||
.addSubcommand((subcommand) => subcommand
|
||
.setName('unassign')
|
||
.setDescription('Remove the link between a character and a Discord player.')
|
||
.addStringOption((option) => option
|
||
.setName('character')
|
||
.setDescription('Character to free (yours by default, anyone’s as a server administrator).')
|
||
.setMaxLength(100)
|
||
.setAutocomplete(true))))
|
||
];
|
||
|
||
module.exports = commands;
|