Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasB25 authored Aug 29, 2024
2 parents a20d5dc + d10045f commit 34f92e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/events/client/InteractionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 5 additions & 6 deletions src/events/client/MessageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
}
}

Expand Down Expand Up @@ -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"),
});
Expand Down

0 comments on commit 34f92e8

Please sign in to comment.