Haha-Yes/event/listeners/commandblocked.js

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-12-30 01:20:24 +01:00
const { Listener } = require('discord-akairo');
class CommandBlockedListener extends Listener {
2019-01-02 08:09:45 +01:00
constructor() {
super('commandBlocked', {
emitter: 'commandHandler',
2019-01-02 21:46:12 +01:00
event: 'commandBlocked'
2019-01-02 08:09:45 +01:00
});
}
2018-12-30 01:20:24 +01:00
2019-01-14 11:33:01 +01:00
async exec(message, command, reason) {
2019-01-02 08:09:45 +01:00
console.log(`${message.author.username} was blocked from using ${command.id} because of ${reason}!`);
let ownerMessage;
switch(reason) {
2019-01-14 11:33:01 +01:00
case 'owner':
2019-01-02 08:09:45 +01:00
ownerMessage = ['Nice try but you aren\'t the owner <a:memed:433320880135733248>', 'LOADING SUPER SECRET COMMAND <a:loadingmin:527579785212329984> Wait a minute... you aren\'t the owner!', 'uhm, how about no'];
ownerMessage = ownerMessage[Math.floor( Math.random() * ownerMessage.length )];
message.reply(ownerMessage);
break;
2019-01-14 11:33:01 +01:00
case 'guild':
message.reply('You can\'t use this command in a guild!');
2019-01-02 08:09:45 +01:00
break;
2019-01-14 11:33:01 +01:00
case 'dm':
message.reply('You can\'t use this command in DM!');
2019-01-02 08:09:45 +01:00
break;
case 'blacklist':
message.reply('You can\'t use this command because you have been blacklisted!');
break;
}
}
2018-12-30 01:20:24 +01:00
}
module.exports = CommandBlockedListener;