Add permission checks
This commit is contained in:
parent
c82f396301
commit
4b950e9689
7 changed files with 17 additions and 4 deletions
|
@ -3,7 +3,8 @@ const { Command } = require('discord-akairo');
|
|||
class AboutCommand extends Command {
|
||||
constructor() {
|
||||
super('about', {
|
||||
aliases: ['about']
|
||||
aliases: ['about'],
|
||||
clientPermissions: ['SEND_MESSAGES']
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ class EvalCommand extends Command {
|
|||
aliases: ['eval', 'e'],
|
||||
ownerOnly: true,
|
||||
quoted: false,
|
||||
clientPermissions: ['SEND_MESSAGES'],
|
||||
args: [
|
||||
{
|
||||
id: 'code',
|
||||
|
|
|
@ -3,7 +3,8 @@ const { Command } = require('discord-akairo');
|
|||
class HelpCommand extends Command {
|
||||
constructor() {
|
||||
super('help', {
|
||||
aliases: ['help']
|
||||
aliases: ['help'],
|
||||
clientPermissions: ['SEND_MESSAGES']
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ const { Command } = require('discord-akairo');
|
|||
class PingCommand extends Command {
|
||||
constructor() {
|
||||
super('ping', {
|
||||
aliases: ['ping']
|
||||
aliases: ['ping'],
|
||||
clientPermissions: ['SEND_MESSAGES']
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ class ReloadCommand extends Command {
|
|||
aliases: ['reload', 'r'],
|
||||
ownerOnly: true,
|
||||
quoted: false,
|
||||
clientPermissions: ['SEND_MESSAGES'],
|
||||
args: [
|
||||
{
|
||||
id: 'type',
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue