diff --git a/commands/roles.js b/commands/roles.js index 751d694..ad97357 100644 --- a/commands/roles.js +++ b/commands/roles.js @@ -7,6 +7,7 @@ const successCard = require('../templates/successCard') const { updateRoles, getRoleIds } = require('../functions/roles') const { getTranslations, getTranslation } = require('../languages/setup') const { isInteractionSubcommandEqual, getInteractionOption } = require('../functions/utility') +const { ephemeral } = require('./team') const SETUP = 'setup' const GENERATE = 'generate' @@ -226,6 +227,7 @@ module.exports = { descriptionLocalizations: getTranslations('options.setupRoles'), type: Discord.ApplicationCommandOptionType.Subcommand, slash: true, + ephemeral: true, options: [ ...Array(10).fill('').map((k, i) => { return { @@ -252,6 +254,7 @@ module.exports = { descriptionLocalizations: getTranslations('options.generateRoles'), type: Discord.ApplicationCommandOptionType.Subcommand, slash: true, + ephemeral: true, options: [ { name: 'remove_old', @@ -267,7 +270,8 @@ module.exports = { description: getTranslation('options.removeRoles', 'en-US'), descriptionLocalizations: getTranslations('options.removeRoles'), type: Discord.ApplicationCommandOptionType.Subcommand, - slash: true + slash: true, + ephemeral: true }, { name: SETUP_ELO, @@ -276,6 +280,7 @@ module.exports = { type: Discord.ApplicationCommandOptionType.Subcommand, slash: true, premium: true, + ephemeral: true, options: [ { name: 'role_name', @@ -317,6 +322,7 @@ module.exports = { descriptionLocalizations: getTranslations('options.removeEloRole'), type: Discord.ApplicationCommandOptionType.Subcommand, slash: true, + ephemeral: true, options: [ { name: 'role', diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 104d739..2b82e3f 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -150,24 +150,25 @@ module.exports = { */ else if (interaction.client.commands.has(interaction.commandName)) { const command = interaction.client.commands.get(interaction.commandName) + const subCommand = command.options + .filter(option => option.type === ApplicationCommandOptionType.Subcommand && option.name === interaction.options.getSubcommand()) + .shift() + interaction - .deferReply({ ephemeral: command.ephemeral }) + .deferReply({ ephemeral: command.ephemeral ?? subCommand?.ephemeral }) .then(async () => { - const premiumSubCommand = command.options - .filter(option => option.type === ApplicationCommandOptionType.Subcommand && option.premium && option.name === interaction.options.getSubcommand()) - - if (premiumSubCommand.length > 0) { + const premiumSubCommand = subCommand?.premium + if (premiumSubCommand) { const isPremium = await currentGuildIsPremium(interaction.client, interaction.guildId) if (!isPremium) { interaction.followUp({ - ephemeral: true, content: ' ', ...premiumCard(interaction.locale), }).catch((error) => errorHandler(interaction, error)) return } } - + CommandsStats.create(interaction.commandName, 'command', interaction) command?.execute(interaction) .then(resp => {