diff --git a/src/buttons/mod-application-accept.js b/src/buttons/mod-application-accept.js index e5ec063..2cb0aea 100644 --- a/src/buttons/mod-application-accept.js +++ b/src/buttons/mod-application-accept.js @@ -16,15 +16,20 @@ async function modApplicationAcceptHandler(interaction) { }); const adminRoleId = await database.getGuildSetting(interaction.guildId, 'admin_role_id'); - if (!adminRoleId) { throw new Error('No admin role ID set!'); } - const hasdAdminRole = interaction.member.roles.cache.get(adminRoleId); + const headModRoleId = await database.getGuildSetting(interaction.guildId, 'head_mod_role_id'); + if (!headModRoleId) { + throw new Error('No head mod role ID set!'); + } + + const hasAdminRole = interaction.member.roles.cache.get(adminRoleId); + const hasHeadModRole = interaction.member.roles.cache.get(headModRoleId); - if (!hasdAdminRole) { - throw new Error('Only administrators have permission to accept/deny applications'); + if (!(hasAdminRole || hasHeadModRole)) { + throw new Error('Only administrators and head mods have permission to accept/deny applications'); } const { message } = interaction; diff --git a/src/modals/mod-application-deny.js b/src/modals/mod-application-deny.js index 2341c7d..870c826 100644 --- a/src/modals/mod-application-deny.js +++ b/src/modals/mod-application-deny.js @@ -26,15 +26,20 @@ async function denyModApplicationHandler(interaction) { }); const adminRoleId = await database.getGuildSetting(interaction.guildId, 'admin_role_id'); - if (!adminRoleId) { throw new Error('No admin role ID set!'); } - const hasdAdminRole = interaction.member.roles.cache.get(adminRoleId); + const headModRoleId = await database.getGuildSetting(interaction.guildId, 'head_mod_role_id'); + if (!headModRoleId) { + throw new Error('No head mod role ID set!'); + } + + const hasAdminRole = interaction.member.roles.cache.get(adminRoleId); + const hasHeadModRole = interaction.member.roles.cache.get(headModRoleId); - if (!hasdAdminRole) { - throw new Error('Only administrators have permission to accept/deny applications'); + if (!(hasAdminRole || hasHeadModRole)) { + throw new Error('Only administrators and head mods have permission to accept/deny applications'); } const { message } = interaction;