feat: finish /force-close command (closes #311)

This commit is contained in:
Isaac
2023-05-29 23:15:50 +01:00
parent 6b066c177a
commit 540ee547ea
3 changed files with 121 additions and 57 deletions

View File

@@ -18,8 +18,12 @@ module.exports = class CategoryCompleter extends Autocompleter {
const client = this.client;
let categories = await client.prisma.category.findMany({ where: { guildId: interaction.guild.id } });
const ticket = await client.prisma.ticket.findUnique({ where: { id: interaction.channel.id } });
if (ticket) categories = categories.filter(category => ticket.categoryId !== category.id);
if (command.name === 'move') {
const ticket = await client.prisma.ticket.findUnique({ where: { id: interaction.channel.id } });
if (ticket) categories = categories.filter(category => ticket.categoryId !== category.id);
}
const options = value ? categories.filter(category => category.name.match(new RegExp(value, 'i'))) : categories;
await interaction.respond(
options
@@ -30,4 +34,4 @@ module.exports = class CategoryCompleter extends Autocompleter {
})),
);
}
};
};