Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const roles = {
- age: {
- ra1: '1062793936357302372',
- ra2: '1062801143400497193',
- ra3: '1062801213332148395',
- ra4: '1062801279153361076',
- },
- pronouns: {
- rp1: '1062801444404723752',
- rp2: '1062801523572220025',
- rp3: '1062801557260861491',
- rp4: '1062801608196501504',
- rp5: '1062801875612737586',
- },
- notif: {
- rn1: '1062802495488929933',
- rn2: '1062802571758141600',
- rn3: '1062802787097911316',
- rn4: '1062803011501568041',
- rn5: '1062803204733141084',
- },
- };
- const SELFROLEspacer = '1062800788851798036';
- module.exports = {
- name: 'interactionCreate',
- /**
- * @param {SelectMenuInteraction} interaction
- * @param {Client} client
- */
- async execute(interaction, client) {
- if (!interaction.isStringSelectMenu()) return;
- const selected = interaction.values;
- const member = interaction.member;
- const selectionid = interaction.customId;
- if (!roles[selectionid]) return;
- Object.keys(roles[selectionid]).forEach((key) => {
- const roleId = roles[selectionid][key];
- if (selected.includes(key)) {
- member.roles.add(roleId);
- } else {
- member.roles.remove(roleId);
- }
- });
- if (!member.roles.cache.has(SELFROLEspacer)) {
- member.roles.add(SELFROLEspacer);
- }
- interaction.reply({
- content: 'Vos rôles ont été mis à jour',
- ephemeral: true,
- });
- setTimeout(function () {
- interaction.deleteReply();
- }, 2000);
- },
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement