2020-03-18 02:28:29 +01:00
|
|
|
const { Inhibitor } = require('discord-akairo');
|
|
|
|
const commandblock = require('../../models').commandBlock;
|
2021-03-13 18:23:43 +01:00
|
|
|
const commandblockuser = require('../../models').commandblockuser;
|
2020-03-18 02:28:29 +01:00
|
|
|
|
|
|
|
class commandblockInhibitor extends Inhibitor {
|
|
|
|
constructor() {
|
|
|
|
super('commandblock', {
|
|
|
|
reason: 'commandblock'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async exec(message, command) {
|
2020-03-19 15:44:00 +01:00
|
|
|
if (message.channel.type == 'dm' || message.author.id == this.client.ownerID || message.member.hasPermission('ADMINISTRATOR')) return false;
|
2020-03-18 02:28:29 +01:00
|
|
|
const blacklist = await commandblock.findOne({where: {serverID:message.guild.id, command: command.id}});
|
2021-03-13 18:23:43 +01:00
|
|
|
const blocked = await commandblockuser.findOne({where: {serverID: message.guild.id, userID: message.author.id, command: command.id}});
|
2020-03-18 02:28:29 +01:00
|
|
|
|
2021-03-13 18:23:43 +01:00
|
|
|
if (blacklist || blocked) return true;
|
2020-03-18 02:28:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = commandblockInhibitor;
|