mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
Implement required roles
This commit is contained in:
parent
53f00b715b
commit
913465a165
@ -161,7 +161,7 @@ log:
|
||||
delete: deleted
|
||||
update: updated
|
||||
ticket:
|
||||
description: '{user} {verb} ticket'
|
||||
description: '{user} {verb} a ticket'
|
||||
ticket: Ticket
|
||||
title: Ticket {verb}
|
||||
verb:
|
||||
@ -178,6 +178,9 @@ misc:
|
||||
blocked:
|
||||
description: You are not allowed to create tickets.
|
||||
title: ❌ Blocked
|
||||
missing_roles:
|
||||
description: You do not have the roles required to be able to create a ticket in this category.
|
||||
title: ❌ Insufficient roles
|
||||
no_categories:
|
||||
description: No ticket categories have been configured.
|
||||
title: ❌ There are no ticket categories
|
||||
|
@ -112,10 +112,25 @@ module.exports = class TicketManager {
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: if member !required roles -> stop
|
||||
if (category.requiredRoles.length !== 0) {
|
||||
const missing = category.requiredRoles.some(r => !member.roles.cache.has(r));
|
||||
if (missing) {
|
||||
return await interaction.reply({
|
||||
embeds: [
|
||||
new ExtendedEmbedBuilder({
|
||||
iconURL: interaction.guild.iconURL(),
|
||||
text: category.guild.footer,
|
||||
})
|
||||
.setColor(category.guild.errorColour)
|
||||
.setTitle(getMessage('misc.missing_roles.title'))
|
||||
.setDescription(getMessage('misc.missing_roles.description')),
|
||||
],
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: if discordCategory has 50 channels -> stop
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user