Browse Source

fix: set default categories properly

pull/48/head
Abheek Dhawan 2 years ago
parent
commit
5bac329fff
Signed by: abheekd GPG Key ID: 7BE81B8C14475B67
  1. 4
      src/commands/train.ts
  2. 2
      src/events/interactionCreate.ts

4
src/commands/train.ts

@ -61,12 +61,12 @@ export async function execute(interaction : CommandInteraction) {
});
let categoryArray : string[] = [];
const allCategories = ['BIOLOGY', 'PHYSICS', 'CHEMISTRY', 'EARTH AND SPACE', 'ASTRONOMY', 'MATH'];
const configCategories = await userConfig.findById(interaction.user.id);
switch (subject) {
case null:
// categoryArray = ['BIOLOGY', 'PHYSICS', 'CHEMISTRY', 'EARTH AND SPACE', 'ASTRONOMY', 'MATH'];
categoryArray = configCategories.subjects || ['BIOLOGY', 'PHYSICS', 'CHEMISTRY', 'EARTH AND SPACE', 'ASTRONOMY', 'MATH'];
categoryArray = (configCategories ? (configCategories.subjects || allCategories) : allCategories);
break;
case 'astro':
case 'astronomy':

2
src/events/interactionCreate.ts

@ -18,6 +18,6 @@ export async function execute(interaction) {
}
catch (error) {
log({ logger: 'interaction', content: `Interaction ${interaction.commandName} failed!`, level: 'error' });
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
}
}

Loading…
Cancel
Save