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 {
|
class AboutCommand extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('about', {
|
super('about', {
|
||||||
aliases: ['about']
|
aliases: ['about'],
|
||||||
|
clientPermissions: ['SEND_MESSAGES']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ class EvalCommand extends Command {
|
||||||
aliases: ['eval', 'e'],
|
aliases: ['eval', 'e'],
|
||||||
ownerOnly: true,
|
ownerOnly: true,
|
||||||
quoted: false,
|
quoted: false,
|
||||||
|
clientPermissions: ['SEND_MESSAGES'],
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
id: 'code',
|
id: 'code',
|
||||||
|
|
|
@ -3,7 +3,8 @@ const { Command } = require('discord-akairo');
|
||||||
class HelpCommand extends Command {
|
class HelpCommand extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('help', {
|
super('help', {
|
||||||
aliases: ['help']
|
aliases: ['help'],
|
||||||
|
clientPermissions: ['SEND_MESSAGES']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@ const { Command } = require('discord-akairo');
|
||||||
class PingCommand extends Command {
|
class PingCommand extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('ping', {
|
super('ping', {
|
||||||
aliases: ['ping']
|
aliases: ['ping'],
|
||||||
|
clientPermissions: ['SEND_MESSAGES']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ class ReloadCommand extends Command {
|
||||||
aliases: ['reload', 'r'],
|
aliases: ['reload', 'r'],
|
||||||
ownerOnly: true,
|
ownerOnly: true,
|
||||||
quoted: false,
|
quoted: false,
|
||||||
|
clientPermissions: ['SEND_MESSAGES'],
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
id: 'type',
|
id: 'type',
|
||||||
|
|
|
@ -10,7 +10,11 @@ class ErrorListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(err, message) {
|
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:',
|
'An error occured:',
|
||||||
'```',
|
'```',
|
||||||
err.toString(),
|
err.toString(),
|
||||||
|
|
|
@ -11,6 +11,10 @@ class MessageInvalidListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(message) {
|
async exec(message) {
|
||||||
|
if (message.guild && !message.channel.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const parse = this.parseMessage(message);
|
const parse = this.parseMessage(message);
|
||||||
if (!parse) {
|
if (!parse) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue