prepare code by splitting functions by subcommand

This commit is contained in:
Baipyrus 2024-04-03 19:30:47 +02:00
parent 62cf257d73
commit 79d69b7360

View File

@ -5,6 +5,30 @@ import {
ChatInputCommandInteraction ChatInputCommandInteraction
} from 'discord.js'; } from 'discord.js';
/** @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) {}
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName('response') .setName('response')
.setDMPermission(false) .setDMPermission(false)
@ -80,10 +104,13 @@ export async function autocomplete(interaction) {
switch (options.getSubcommand()) { switch (options.getSubcommand()) {
case 'add': case 'add':
addAutocomplete(interaction);
break; break;
case 'remove': case 'remove':
removeAutocomplete(interaction);
break; break;
case 'info': case 'info':
infoAutocomplete(interaction);
break; break;
} }
} }
@ -93,14 +120,19 @@ export async function execute(interaction) {
switch (options.getSubcommand()) { switch (options.getSubcommand()) {
case 'create': case 'create':
createResponse(interaction);
break; break;
case 'add': case 'add':
addResponse(interaction);
break; break;
case 'remove': case 'remove':
removeResponse(interaction);
break; break;
case 'list': case 'list':
listResponse(interaction);
break; break;
case 'info': case 'info':
infoResponse(interaction);
break; break;
} }
} }