mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
9bd39c69ca
sinon il y a pleins de truc comme les anti raid , des coorectif ect
31 lines
1011 B
JavaScript
31 lines
1011 B
JavaScript
const {Events } = require("discord.js")
|
|
|
|
module.exports = {
|
|
name: Events.InteractionCreate,
|
|
async execute(interaction, client) {
|
|
const botId = client.user.id;
|
|
const customId = interaction.customId;
|
|
if (customId == undefined || customId === null) return;
|
|
if (!customId.startsWith('rolebuttons_')) return;
|
|
|
|
const roleId = customId.split('_')[1];
|
|
const role = interaction.guild.roles.cache.get(roleId);
|
|
|
|
if (!role) {
|
|
return;
|
|
}
|
|
|
|
const member = interaction.member;
|
|
if (!member) {
|
|
return;
|
|
}
|
|
|
|
if (member.roles.cache.has(role.id)) {
|
|
await member.roles.remove(role);
|
|
await interaction.reply({ content: `Le rôle ${role.name} a été retiré.`, ephemeral: true });
|
|
} else {
|
|
await member.roles.add(role);
|
|
await interaction.reply({ content: `Le rôle ${role.name} a été ajouté.`, ephemeral: true });
|
|
}
|
|
},
|
|
}; |