Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { RichEmbed } = require('discord.js');
- exports.run = async (client, message, args) => {
- await message.delete().catch(O_o=>{});
- const a = message.guild.roles.get('580876208321855491'); // gta 5m
- const b = message.guild.roles.get('580876024355618839'); // mc
- const filter = (reaction, user) => ['🚗', '🗡'].includes(reaction.emoji.name) && user.id === message.author.id;
- const embed = new RichEmbed()
- .setTitle('Available Roles')
- .setDescription(`
- 🚗 ${a.toString()}
- 🗡 ${b.toString()}
- `)
- .setColor(0xdd9323)
- .setFooter(`ID: ${message.author.id}`);
- message.channel.send(embed).then(async msg => {
- await msg.react('🚗');
- await msg.react('🗡');
- msg.awaitReactions(filter, {
- max: 1,
- time: 30000,
- errors: ['time']
- }).then(collected => {
- const reaction = collected.first();
- switch (reaction.emoji.name) {
- case '🚗':
- if (message.member.roles.has(a.id)) {
- msg.delete(2000);
- return message.channel.send('You are already in this role!').then(m => m.delete(3000));
- }
- message.member.addRole(a).catch(err => {
- console.log(err);
- return message.channel.send(`Error adding you to this role: **${err.message}**.`);
- });
- message.channel.send(`You have been added to the **${a.name}** role!`).then(m => m.delete(3000));
- msg.delete();
- break;
- case '🗡':
- if (message.member.roles.has(b.id)) {
- msg.delete(2000);
- return message.channel.send('You are already in this role!').then(m => m.delete(3000));
- }
- message.member.addRole(b).catch(err => {
- console.log(err);
- return message.channel.send(`Error adding you to this role: **${err.message}**.`);
- });
- message.channel.send(`You have been added to the **${b.name}** role!`).then(m => m.delete(3000));
- msg.delete();
- break;
- }
- }).catch(collected => {
- return message.channel.send(`I couldn't add you to this role!`);
- });
- });
- };
- exports.help = {
- name: '?roles'
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement