fix: only allow /topic in tickets

This commit is contained in:
Isaac 2022-10-26 10:26:43 +01:00
parent 72e264d04c
commit 9a916339ef
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -7,6 +7,7 @@ const {
} = require('discord.js');
const Cryptr = require('cryptr');
const { decrypt } = new Cryptr(process.env.ENCRYPTION_KEY);
const ExtendedEmbedBuilder = require('../../lib/embed');
module.exports = class TopicSlashCommand extends SlashCommand {
constructor(client, options) {
@ -43,6 +44,22 @@ module.exports = class TopicSlashCommand extends SlashCommand {
where: { id: interaction.channel.id },
});
if (!ticket) {
const settings = await client.prisma.guild.findUnique({ where: { id: interaction.guild.id } });
const getMessage = client.i18n.getLocale(settings.locale);
return await interaction.reply({
embeds: [
new ExtendedEmbedBuilder({
iconURL: interaction.guild.iconURL(),
text: settings.footer,
})
.setColor(settings.errorColour)
.setTitle(getMessage('misc.not_ticket.title'))
.setDescription(getMessage('misc.not_ticket.description')),
],
});
}
const getMessage = client.i18n.getLocale(ticket.guild.locale);
await interaction.showModal(