1
0
Fork 0

fix command handler issue

refactor/models
Matthew 2019-10-27 22:41:34 -04:00
parent e0750f7787
commit 51c8b12e84
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@ export default class {
if (!resolved) return; if (!resolved) return;
if (resolved.guildOnly && !(message.channel instanceof TextChannel)) return; if (resolved.guildOnly && !(message.channel instanceof TextChannel)) return;
let hasUserPerms: boolean; let hasUserPerms: boolean;
this.client.signale.debug(hasUserPerms);
if (resolved.permissions.users) { if (resolved.permissions.users) {
hasUserPerms = resolved.permissions.users.includes(message.author.id); hasUserPerms = resolved.permissions.users.includes(message.author.id);
} else { } else {
@ -27,13 +28,17 @@ export default class {
let hasRolePerms: boolean = false; let hasRolePerms: boolean = false;
if (resolved.permissions.roles) { if (resolved.permissions.roles) {
for (const role of resolved.permissions.roles) { for (const role of resolved.permissions.roles) {
this.client.signale.debug(message.member.roles.includes(role));
if (message.member && message.member.roles.includes(role)) { if (message.member && message.member.roles.includes(role)) {
// this.client.signale.debug(message.member.roles.includes(role)); // this.client.signale.debug(message.member.roles.includes(role));
hasRolePerms = true; break; hasRolePerms = true; break;
} }
} }
} }
if (!hasRolePerms || !hasUserPerms) return; this.client.signale.debug('---');
this.client.signale.debug(hasUserPerms);
this.client.signale.debug(hasRolePerms);
if (!hasRolePerms && !hasUserPerms) return;
if (!resolved.enabled) { message.channel.createMessage(`***${this.client.stores.emojis.error} This command has been disabled***`); return; } if (!resolved.enabled) { message.channel.createMessage(`***${this.client.stores.emojis.error} This command has been disabled***`); return; }
const args: string[] = noPrefix.slice(1); const args: string[] = noPrefix.slice(1);
resolved.run(message, args); resolved.run(message, args);