From 7744d3a72e42319bc5f3cf0bb2f63960663a2ab5 Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Tue, 15 Jul 2025 15:42:50 -0400 Subject: [PATCH] Fix permission checks on api/inline/alias --- src/commands/aliasCmd/aliasAddUpdate.ts | 2 +- src/commands/aliasCmd/aliasDelete.ts | 2 +- src/commands/aliasCmd/clone.ts | 2 +- src/commands/aliasCmd/rename.ts | 2 +- src/commands/apiCmd.ts | 2 +- src/commands/toggleInline.ts | 3 +-- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/commands/aliasCmd/aliasAddUpdate.ts b/src/commands/aliasCmd/aliasAddUpdate.ts index c55c01b..7045e7a 100644 --- a/src/commands/aliasCmd/aliasAddUpdate.ts +++ b/src/commands/aliasCmd/aliasAddUpdate.ts @@ -32,7 +32,7 @@ const sortYVars = (a: string, b: string) => { }; const handleAddUpdate = async (message: DiscordenoMessage, guildMode: boolean, argSpaces: string[], replaceAlias: boolean) => { - if (guildMode && !(await hasGuildPermissions(message.authorId, message.guildId, ['ADMINISTRATOR']))) { + if (guildMode && !(await hasGuildPermissions(message.guildId, message.authorId, ['ADMINISTRATOR']))) { message .send({ embeds: [ diff --git a/src/commands/aliasCmd/aliasDelete.ts b/src/commands/aliasCmd/aliasDelete.ts index 748dda2..99522bd 100644 --- a/src/commands/aliasCmd/aliasDelete.ts +++ b/src/commands/aliasCmd/aliasDelete.ts @@ -10,7 +10,7 @@ import { failColor, successColor, warnColor } from 'embeds/colors.ts'; import utils from 'utils/utils.ts'; const handleDelete = async (message: DiscordenoMessage, guildMode: boolean, argSpaces: string[], deleteAll: boolean) => { - if (guildMode && !(await hasGuildPermissions(message.authorId, message.guildId, ['ADMINISTRATOR']))) { + if (guildMode && !(await hasGuildPermissions(message.guildId, message.authorId, ['ADMINISTRATOR']))) { message .send({ embeds: [ diff --git a/src/commands/aliasCmd/clone.ts b/src/commands/aliasCmd/clone.ts index 2b6ceaf..b4c37e0 100644 --- a/src/commands/aliasCmd/clone.ts +++ b/src/commands/aliasCmd/clone.ts @@ -16,7 +16,7 @@ interface QueryShape { } export const clone = async (message: DiscordenoMessage, guildMode: boolean, argSpaces: string[]) => { - if (!guildMode && !(await hasGuildPermissions(message.authorId, message.guildId, ['ADMINISTRATOR']))) { + if (!guildMode && !(await hasGuildPermissions(message.guildId, message.authorId, ['ADMINISTRATOR']))) { message .send({ embeds: [ diff --git a/src/commands/aliasCmd/rename.ts b/src/commands/aliasCmd/rename.ts index 01b6bf6..117cd10 100644 --- a/src/commands/aliasCmd/rename.ts +++ b/src/commands/aliasCmd/rename.ts @@ -14,7 +14,7 @@ interface QueryShape { } export const rename = async (message: DiscordenoMessage, guildMode: boolean, argSpaces: string[]) => { - if (guildMode && !(await hasGuildPermissions(message.authorId, message.guildId, ['ADMINISTRATOR']))) { + if (guildMode && !(await hasGuildPermissions(message.guildId, message.authorId, ['ADMINISTRATOR']))) { message .send({ embeds: [ diff --git a/src/commands/apiCmd.ts b/src/commands/apiCmd.ts index aba0e0a..2ac827a 100644 --- a/src/commands/apiCmd.ts +++ b/src/commands/apiCmd.ts @@ -36,7 +36,7 @@ export const api = async (message: DiscordenoMessage, args: string[]) => { } // Makes sure the user is authenticated to run the API command - if (await hasGuildPermissions(message.authorId, message.guildId, ['ADMINISTRATOR'])) { + if (await hasGuildPermissions(message.guildId, message.authorId, ['ADMINISTRATOR'])) { switch (apiArg) { case 'help': case 'h': diff --git a/src/commands/toggleInline.ts b/src/commands/toggleInline.ts index 90cd98c..e5f72f4 100644 --- a/src/commands/toggleInline.ts +++ b/src/commands/toggleInline.ts @@ -51,8 +51,7 @@ export const toggleInline = async (message: DiscordenoMessage, args: string[]) = }); if (errorOut) return; - // Makes sure the user is authenticated to run the API command - if (await hasGuildPermissions(message.authorId, message.guildId, ['ADMINISTRATOR'])) { + if (await hasGuildPermissions(message.guildId, message.authorId, ['ADMINISTRATOR'])) { let enable = false; switch (apiArg) { case 'allow':