2024-04-03 16:45:10 +00:00
|
|
|
import {
|
|
|
|
SlashCommandBuilder,
|
|
|
|
PermissionFlagsBits,
|
|
|
|
AutocompleteInteraction,
|
|
|
|
ChatInputCommandInteraction
|
|
|
|
} from 'discord.js';
|
|
|
|
|
2024-04-03 17:30:47 +00:00
|
|
|
/** @param {ChatInputCommandInteraction} interaction */
|
|
|
|
async function createResponse(interaction) {}
|
|
|
|
|
|
|
|
/** @param {ChatInputCommandInteraction} interaction */
|
|
|
|
async function addResponse(interaction) {}
|
|
|
|
|
|
|
|
/** @param {ChatInputCommandInteraction} interaction */
|
|
|
|
async function removeResponse(interaction) {}
|
|
|
|
|
|
|
|
/** @param {ChatInputCommandInteraction} interaction */
|
|
|
|
async function listResponse(interaction) {}
|
|
|
|
|
|
|
|
/** @param {ChatInputCommandInteraction} interaction */
|
|
|
|
async function infoResponse(interaction) {}
|
|
|
|
|
|
|
|
/** @param {AutocompleteInteraction} interaction */
|
|
|
|
async function addAutocomplete(interaction) {}
|
|
|
|
|
|
|
|
/** @param {AutocompleteInteraction} interaction */
|
|
|
|
async function removeAutocomplete(interaction) {}
|
|
|
|
|
|
|
|
/** @param {AutocompleteInteraction} interaction */
|
|
|
|
async function infoAutocomplete(interaction) {}
|
|
|
|
|
2024-04-03 16:45:10 +00:00
|
|
|
export const data = new SlashCommandBuilder()
|
|
|
|
.setName('response')
|
|
|
|
.setDMPermission(false)
|
|
|
|
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)
|
|
|
|
.setDescription('Event based responses to specific messages with keywords.')
|
|
|
|
.addSubcommand((subcommand) =>
|
|
|
|
subcommand
|
|
|
|
.setName('create')
|
|
|
|
.setDescription('Creates a new event based response.')
|
|
|
|
.addStringOption((option) =>
|
|
|
|
option
|
|
|
|
.setName('keyword')
|
|
|
|
.setDescription('The keyword to trigger the response.')
|
|
|
|
.setRequired(true)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.addSubcommand((subcommand) =>
|
|
|
|
subcommand
|
|
|
|
.setName('add')
|
|
|
|
.setDescription('Registers a response to a keyword.')
|
|
|
|
.addStringOption((option) =>
|
|
|
|
option
|
|
|
|
.setName('keyword')
|
|
|
|
.setDescription('The keyword to trigger the response.')
|
|
|
|
.setAutocomplete(true)
|
|
|
|
.setRequired(true)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.addSubcommand((subcommand) =>
|
|
|
|
subcommand
|
|
|
|
.setName('remove')
|
|
|
|
.setDescription('Unregisters a response to a keyword.')
|
|
|
|
.addStringOption((option) =>
|
|
|
|
option
|
|
|
|
.setName('type')
|
|
|
|
.setDescription('The type of data to be removed.')
|
|
|
|
.setRequired(true)
|
|
|
|
.addChoices(
|
|
|
|
{ name: 'Keyword', value: 'keyword' },
|
|
|
|
{ name: 'Response', value: 'response' }
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.addStringOption((option) =>
|
|
|
|
option
|
|
|
|
.setName('name')
|
|
|
|
.setDescription('The name of the data to be removed.')
|
|
|
|
.setAutocomplete(true)
|
|
|
|
.setRequired(true)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.addSubcommand((subcommand) =>
|
|
|
|
subcommand.setName('list').setDescription('Lists all registered keywords.')
|
|
|
|
)
|
|
|
|
.addSubcommand((subcommand) =>
|
|
|
|
subcommand
|
|
|
|
.setName('info')
|
|
|
|
.setDescription('Shows information about a registered keyword.')
|
|
|
|
.addStringOption((option) =>
|
|
|
|
option
|
|
|
|
.setName('keyword')
|
|
|
|
.setDescription('The keyword to show the details of.')
|
|
|
|
.setAutocomplete(true)
|
|
|
|
.setRequired(true)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
/** @param {ModalSubmitInteraction} interaction */
|
|
|
|
export async function modalSubmit(interaction) {
|
|
|
|
// Only executable in 'add' subcommand
|
|
|
|
}
|
|
|
|
/** @param {AutocompleteInteraction} interaction */
|
|
|
|
export async function autocomplete(interaction) {
|
|
|
|
const { options } = interaction;
|
|
|
|
|
|
|
|
switch (options.getSubcommand()) {
|
|
|
|
case 'add':
|
2024-04-03 17:30:47 +00:00
|
|
|
addAutocomplete(interaction);
|
2024-04-03 16:45:10 +00:00
|
|
|
break;
|
|
|
|
case 'remove':
|
2024-04-03 17:30:47 +00:00
|
|
|
removeAutocomplete(interaction);
|
2024-04-03 16:45:10 +00:00
|
|
|
break;
|
|
|
|
case 'info':
|
2024-04-03 17:30:47 +00:00
|
|
|
infoAutocomplete(interaction);
|
2024-04-03 16:45:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** @param {ChatInputCommandInteraction} interaction */
|
|
|
|
export async function execute(interaction) {
|
|
|
|
const { options } = interaction;
|
|
|
|
|
|
|
|
switch (options.getSubcommand()) {
|
|
|
|
case 'create':
|
2024-04-03 17:30:47 +00:00
|
|
|
createResponse(interaction);
|
2024-04-03 16:45:10 +00:00
|
|
|
break;
|
|
|
|
case 'add':
|
2024-04-03 17:30:47 +00:00
|
|
|
addResponse(interaction);
|
2024-04-03 16:45:10 +00:00
|
|
|
break;
|
|
|
|
case 'remove':
|
2024-04-03 17:30:47 +00:00
|
|
|
removeResponse(interaction);
|
2024-04-03 16:45:10 +00:00
|
|
|
break;
|
|
|
|
case 'list':
|
2024-04-03 17:30:47 +00:00
|
|
|
listResponse(interaction);
|
2024-04-03 16:45:10 +00:00
|
|
|
break;
|
|
|
|
case 'info':
|
2024-04-03 17:30:47 +00:00
|
|
|
infoResponse(interaction);
|
2024-04-03 16:45:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|