diff --git a/src/commands/settings.ts b/src/commands/settings.ts index 8166415..0713e91 100644 --- a/src/commands/settings.ts +++ b/src/commands/settings.ts @@ -16,9 +16,11 @@ export async function execute(interaction : CommandInteraction) { const user = interaction.options.getUser('user') || interaction.user; + const client = interaction.client; + settingsEmbed .setAuthor({ name: user.tag, iconURL: user.displayAvatarURL() }) - .setDescription(`a`); + .setDescription(`selections`); const menu = new MessageActionRow() .addComponents( new MessageSelectMenu() @@ -26,17 +28,32 @@ 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: 'gradeLevels', + description: 'grade levels', + value: 'gradeLevels', }, ]), ); - await interaction.followUp({ embeds: [settingsEmbed] }); + + await interaction.followUp({ embeds: [settingsEmbed], components: [menu] }); + //everything below this line is bad + client.on('interactionCreate', async interaction => { + if (!interaction.isSelectMenu()) return; + var values = interaction.values[0]; //potential breaking point + switch(values) { + case 'subjects': + await interaction.update({ content: 'subjects was selected!', components: [] }); + break; + case 'gradeLevels': + await interaction.update({ 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..9c4f7c7 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -6,10 +6,12 @@ export const once = false; export async function execute(interaction) { const client = interaction.client; + if (!interaction.isCommand()) return; const command = client.commands.get(interaction.commandName); - if (!command) return; + + if (!command) return; //h try { await command.execute(interaction);