forked from Galactic/galactic-bot
inhibitor
This commit is contained in:
parent
17d3fb5e22
commit
759d9ccc5e
27
src/structure/components/inhibitors/Disabled.js
Normal file
27
src/structure/components/inhibitors/Disabled.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user