From d10045f5482c2b0ca90fa20f57e1fb88207f3355 Mon Sep 17 00:00:00 2001 From: LucasB25 <50886682+LucasB25@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:21:48 +0200 Subject: [PATCH] fix --- src/events/client/InteractionCreate.ts | 2 +- src/events/client/MessageCreate.ts | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/events/client/InteractionCreate.ts b/src/events/client/InteractionCreate.ts index 04657355a..693853fc5 100644 --- a/src/events/client/InteractionCreate.ts +++ b/src/events/client/InteractionCreate.ts @@ -94,7 +94,7 @@ export default class InteractionCreate extends Event { return; } - if (command.permissions.dev && this.client.config.owners) { + if (command.permissions?.dev && this.client.config.owners) { const isDev = this.client.config.owners.includes(interaction.user.id); if (!isDev) return; } diff --git a/src/events/client/MessageCreate.ts b/src/events/client/MessageCreate.ts index f05bf2319..a1e2a6701 100644 --- a/src/events/client/MessageCreate.ts +++ b/src/events/client/MessageCreate.ts @@ -75,8 +75,6 @@ export default class MessageCreate extends Event { .catch(() => {}); } - const isDev = this.client.config.owners?.includes(message.author.id); - if (command.permissions) { if (command.permissions?.client) { const missingClientPermissions = command.permissions.client.filter((perm) => !clientMember.permissions.has(perm)); @@ -90,15 +88,16 @@ export default class MessageCreate extends Event { } } - if (command.permissions?.user && !isDev) { + if (command.permissions?.user) { if (!(message.member as GuildMember).permissions.has(command.permissions.user)) { return await message.reply({ content: T(locale, "event.message.no_user_permission"), }); } - if (command.permissions.dev && !isDev) { - return; + if (command.permissions?.dev && this.client.config.owners) { + const isDev = this.client.config.owners.includes(message.author.id); + if (!isDev) return; } } @@ -180,7 +179,7 @@ export default class MessageCreate extends Event { const hasDJRole = (message.member as GuildMember).roles.cache.some((role) => djRole.map((r) => r.roleId).includes(role.id), ); - if (!((hasDJRole && !(message.member as GuildMember).permissions.has(PermissionFlagsBits.ManageGuild)) || !isDev)) { + if (!(hasDJRole && !(message.member as GuildMember).permissions.has(PermissionFlagsBits.ManageGuild))) { return await message.reply({ content: T(locale, "event.message.no_dj_permission"), });