Add role requirement to open a ticket

This commit is contained in:
Ninjdai 2023-05-13 10:18:38 +02:00
parent 1ba27c15f7
commit 283eaa15f4

View File

@ -1,8 +1,16 @@
const { ActionRowBuilder, StringSelectMenuBuilder } = require('discord.js')
const { ActionRowBuilder, StringSelectMenuBuilder, EmbedBuilder } = require('discord.js')
module.exports = {
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
if(interaction.customId.endsWith("free")){
if(
!interaction.member.roles.cache.has('1104145272499621928') &&
!interaction.member.roles.cache.has('1104146176627970249') &&
!interaction.member.roles.cache.has('1104146641721761843') &&
!interaction.member.roles.cache.has('1104147264500400142')
) return interaction.editReply({ embeds: [hasNotRoleEMBED] })
}
const ticketgraphismtyperow2 = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder()
@ -58,4 +66,9 @@ module.exports = {
);
await interaction.editReply({ components: [ticketgraphismtyperow2] })
}
}
}
const hasNotRoleEMBED = new EmbedBuilder()
.setTitle("Désolé !")
.setColor("#db2a06")
.setDescription('Pour pouvoir ouvrir un ticket bénévole, vous devez avoir le rôle <@&1104145272499621928> !\nCela nous permet de ne pas être noyés sous les commandes tout en laissant l\'accès aux commandes bénévole possible.!')