inhibitor

This commit is contained in:
Erik 2022-04-20 16:00:03 +03:00
parent 17d3fb5e22
commit 759d9ccc5e
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -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;