Skip to content

Commit

Permalink
fix: allow support crew to close helpdesk threads (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
bo0tzz authored Sep 7, 2024
1 parent 6e5fcbe commit a95fab3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const tags = {

const roles = {
Contributor: '980972470964215870',
SupportCrew: '1184258769312551053',
};

export const Constants = {
Expand Down
8 changes: 5 additions & 3 deletions src/discord/help-desk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ export class DiscordHelpDesk {
}

const members = interaction.guild?.members.cache;
const isContributor = members?.get(interaction.user.id)?.roles.cache.has(Constants.Roles.Contributor);
const userRoles = members?.get(interaction.user.id)?.roles.cache;
const isContributor = userRoles?.has(Constants.Roles.Contributor);
const isSupportCrew = userRoles?.has(Constants.Roles.SupportCrew);

if (!(isContributor || channel.ownerId === interaction.user.id)) {
return interaction.reply({ ephemeral: true, content: 'Only the OP and contributors can close a thread.' });
if (!(isContributor || isSupportCrew || channel.ownerId === interaction.user.id)) {
return interaction.reply({ ephemeral: true, content: 'Only the OP and team members can close a thread.' });
}

const buttonRow = new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
Expand Down

0 comments on commit a95fab3

Please sign in to comment.