Browse Source

Revert "Update to settings.ts"

This reverts commit 8faac8d2bf.
pull/43/head
Eric Yang 3 years ago
parent
commit
5b70817356
  1. 29
      src/commands/settings.ts
  2. 10
      src/events/interactionCreate.ts

29
src/commands/settings.ts

@ -26,30 +26,17 @@ export async function execute(interaction : CommandInteraction) {
.setPlaceholder('Nothing selected')
.addOptions([
{
label: 'Subjects',
description: 'Subjects',
value: 'subjects',
label: 'Select me',
description: 'This is a description',
value: 'first_option',
},
{
label: 'Grade Levels',
description: 'Grade Levels',
value: 'gradeLevels',
label: 'You can select me too',
description: 'This is also a description',
value: 'second_option',
},
]),
);
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;
}
});
await interaction.followUp({ embeds: [settingsEmbed] });
}

10
src/events/interactionCreate.ts

@ -4,17 +4,11 @@ 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 {
@ -24,6 +18,4 @@ 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