diff --git a/src/structure/components/inhibitors/Disabled.js b/src/structure/components/inhibitors/Disabled.js new file mode 100644 index 0000000..cc78a8c --- /dev/null +++ b/src/structure/components/inhibitors/Disabled.js @@ -0,0 +1,27 @@ +const { Inhibitor } = require("../../interfaces"); + +class Disabled extends Inhibitor { + + constructor(client) { + super(client, { + name: 'disabled', + priority: 9, + silent: true + }); + } + + async execute(interaction, command) { + if (command.disabled) return super._fail({ modifier: interaction.format('INHIBITOR_DISABLED', { globally: true }, { code: true }) }); + if (!interaction.guild) return super._succeed(); + + const settings = await interaction.guild.settings(); + if (settings.disabledCommands?.includes(command.resolveable)) return super._fail({ + modifier: interaction.format('INHIBITOR_DISABLED', { globally: false }, { code: true }) + }); + + return super._succeed(); + } + +} + +module.exports = Disabled; \ No newline at end of file