Files
dragonroll/discord-bot/src/commands.js
Aran Roig 1402045001
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 1m51s
Foundry and discord bot
2026-10-11 22:26:29 +02:00

58 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;