From 9a916339efb847b6940e382ee6eebca56a8e1153 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 26 Oct 2022 10:26:43 +0100 Subject: [PATCH] fix: only allow `/topic` in tickets --- src/commands/slash/topic.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/commands/slash/topic.js b/src/commands/slash/topic.js index c3e8049..751c93d 100644 --- a/src/commands/slash/topic.js +++ b/src/commands/slash/topic.js @@ -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(