Browse Source

Update to settings.ts

pull/43/head
Eric Yang 3 years ago
parent
commit
8faac8d2bf
  1. 27
      src/commands/settings.ts
  2. 8
      src/events/interactionCreate.ts

27
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;
}
});
}

8
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 });
}
//
}
Loading…
Cancel
Save