Add permission checks

This commit is contained in:
1computer1 2019-03-12 12:51:10 -04:00
parent c82f396301
commit 4b950e9689
7 changed files with 17 additions and 4 deletions

View file

@ -3,7 +3,8 @@ const { Command } = require('discord-akairo');
class AboutCommand extends Command {
constructor() {
super('about', {
aliases: ['about']
aliases: ['about'],
clientPermissions: ['SEND_MESSAGES']
});
}

View file

@ -7,6 +7,7 @@ class EvalCommand extends Command {
aliases: ['eval', 'e'],
ownerOnly: true,
quoted: false,
clientPermissions: ['SEND_MESSAGES'],
args: [
{
id: 'code',

View file

@ -3,7 +3,8 @@ const { Command } = require('discord-akairo');
class HelpCommand extends Command {
constructor() {
super('help', {
aliases: ['help']
aliases: ['help'],
clientPermissions: ['SEND_MESSAGES']
});
}

View file

@ -3,7 +3,8 @@ const { Command } = require('discord-akairo');
class PingCommand extends Command {
constructor() {
super('ping', {
aliases: ['ping']
aliases: ['ping'],
clientPermissions: ['SEND_MESSAGES']
});
}

View file

@ -6,6 +6,7 @@ class ReloadCommand extends Command {
aliases: ['reload', 'r'],
ownerOnly: true,
quoted: false,
clientPermissions: ['SEND_MESSAGES'],
args: [
{
id: 'type',

View file

@ -10,7 +10,11 @@ class ErrorListener extends Listener {
}
exec(err, message) {
message.util.send([
if (message.guild && !message.channel.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return null;
}
return message.util.send([
'An error occured:',
'```',
err.toString(),

View file

@ -11,6 +11,10 @@ class MessageInvalidListener extends Listener {
}
async exec(message) {
if (message.guild && !message.channel.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return null;
}
const parse = this.parseMessage(message);
if (!parse) {
return null;