move permission handler into functions
This commit is contained in:
parent
c69d2f562d
commit
5ffce3ff95
1 changed files with 17 additions and 2 deletions
|
@ -74,11 +74,26 @@ class Functions {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
intBetween (min, max) {
|
checkPermissions (command, message, member) {
|
||||||
return Math.round((Math.random() * (max - min) + min));
|
const missingPerms = [];
|
||||||
|
|
||||||
|
if (member.user.bot) {
|
||||||
|
command.conf.botPerms.forEach(p => {
|
||||||
|
if (!message.channel.permissionsFor(member).has(p)) missingPerms.push(p);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
command.conf.userPerms.forEach(p => {
|
||||||
|
if (!message.channel.permissionsFor(member).has(p)) missingPerms.push(p);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (missingPerms.length > 0) return missingPerms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
intBetween (min, max) {
|
||||||
|
return Math.round((Math.random() * (max - min) + min));
|
||||||
|
}
|
||||||
|
|
||||||
isDeveloper (id) {
|
isDeveloper (id) {
|
||||||
if (this.client.config.ownerIDs.includes(id)) {
|
if (this.client.config.ownerIDs.includes(id)) {
|
||||||
|
|
Loading…
Reference in a new issue