modmail/structure/commands/Disable.js

29 lines
690 B
JavaScript
Raw Normal View History

2021-12-22 10:30:50 +01:00
const Command = require('../Command');
const Util = require('../Util');
2021-12-22 10:30:50 +01:00
class Ping extends Command {
constructor (client) {
super(client, {
name: 'disable',
aliases: [ 'enable' ]
});
}
async execute ({ author, member, _caller }, { clean }) {
const { sudo } = this.client._options;
const roleIds = member.roles.cache.map(r => r.id);
if (!Util.arrayIncludesAny(roleIds, sudo) && !sudo.includes(author.id)) return;
2021-12-22 10:30:50 +01:00
if (_caller === 'enable') this.client.modmail.enable();
else this.client.modmail.disable(clean);
return `:thumbsup: ${_caller}d`;
}
}
module.exports = Ping;