diff --git a/src/commands/settings.ts b/src/commands/settings.ts index 8166415..775855c 100644 --- a/src/commands/settings.ts +++ b/src/commands/settings.ts @@ -26,17 +26,30 @@ export async function execute(interaction : CommandInteraction) { .setPlaceholder('Nothing selected') .addOptions([ { - label: 'Select me', - description: 'This is a description', - value: 'first_option', + label: 'Subjects', + description: 'Subjects', + value: 'subjects', }, { - label: 'You can select me too', - description: 'This is also a description', - value: 'second_option', + label: 'Grade Levels', + description: 'Grade Levels', + value: 'gradeLevels', }, ]), ); - await interaction.followUp({ embeds: [settingsEmbed] }); - + await interaction.followUp({ embeds: [settingsEmbed], components: [menu] }); + const client = interaction.client; + client.on('interactionCreate', async interaction => { + if (!interaction.isSelectMenu()) return; + var values = interaction.values[1]; + switch(values) { + case "subjects": + await interaction.editReply({ content: 'subjects was selected!', components: [] }); + break; + case "gradeLevels": + await interaction.editReply({ content: 'levels was selected!', components: [] }); + break; + } + }); + } \ No newline at end of file diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index 8cdd4b0..60cf296 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -4,11 +4,17 @@ export const name = 'interactionCreate'; export const once = false; +declare global { + var client; +} + export async function execute(interaction) { const client = interaction.client; + if (!interaction.isCommand()) return; const command = client.commands.get(interaction.commandName); + if (!command) return; try { @@ -18,4 +24,6 @@ export async function execute(interaction) { log({ logger: 'interaction', content: `Interaction ${interaction.name} failed!`, level: 'error' }); await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }); } -} \ No newline at end of file +// + +}