const ButtonRoles = ['893971666865115216', '893971717762986055', '893971716898947162', '893971716068478976', '759466114241265675', '759466115683844126', '759450613960147024', '931223449588879370', '976796592545878017'] if (ButtonRoles.includes(interaction.customId)) { await interaction.deferReply({ ephemeral: true }) const MechRoles = ['893971666865115216', '893971717762986055', '893971716898947162', '893971716068478976'] const REARoles = ['759466114241265675', '759466115683844126'] const CarRoles = ['759450613960147024', '931223449588879370'] const impoundRoles = ['976796592545878017'] const selectedRole = interaction.guild.roles.cache.get(interaction.customId) console.log(interaction.customId) console.log(selectedRole.name) if (REARoles.includes(interaction.customId)) { if (!interaction.member.roles.cache.has('738088650687905959')) return interaction.editReply({ content: `Shoma be role <@&738088650687905959> baraye dadane role ${selectedRole} niaz darid` }) await interaction.editReply({ content: `lotfan usere morede nazar ro mention konid ta role ${selectedRole} beheshon dade beshe va ya azashon gerefte beshe (30S)\ndar sorati ke eshtebah roye in gozine click kardid kafist ta **"Cancel"** ro ersal konid.` }) const filter = m => m.member.id === interaction.member.id; const collector = await interaction.channel.createMessageCollector({ filter, time: 30 * 1000 }); collector.on('collect', async (message) => { await message.delete() if (message.content.toLowerCase() === 'cancel') { await interaction.editReply({ content: 'Amaliat Cancel shod' }) return collector.stop() } const mMember = message.mentions.members.first() if (!mMember) { await interaction.editReply({ content: `Shoma Bayad yek member ro mention konid` }) return collector.stop() } if (mMember.user.bot) { await interaction.editReply({ content: `Shoma nemitavanid role ${selectedRole} ro be ${mMember} bedahid va ya az oo role ro begirid` }) return collector.stop() } if (!mMember.roles.cache.has(selectedRole)) { await mMember.roles.add(selectedRole).catch(e => console.log(e)) await interaction.editReply({ content: `Role ${selectedRole} be ${mMember} dade shod` }) return collector.stop() } if (mMember.roles.cache.has(selectedRole)) { await mMember.roles.remove(selectedRole).catch(e => console.log(e)) await interaction.editReply({ content: `Role ${selectedRole} az ${mMember} gerefte shod` }) return collector.stop() } }); collector.on('end', async (collected, reason) => { if (reason === 'time') return interaction.editReply({ content: 'Zaman shoma be etmam resid' }) }); }