Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This command gives the User the "Member-Role" and removes the "Guest-Role"
- //Also only Admins can run this code
- module.exports = {
- name: 'member',
- description: "Sets up a reaction role message!",
- async execute(message, args, Discord, client) {
- const channel = '_ChannelID_';
- const yellowTeamRole = message.guild.roles.cache.find(role => role.name === "Member");
- const blueTeamRole = message.guild.roles.cache.find(role => role.name === "Gast");
- const yellowTeamEmoji = '☑️';
- //You can only run the command if you re admin
- if(message.member.permissions.has("ADMINISTRATOR")){
- let embed = new Discord.MessageEmbed()
- .setColor('#5673f0')
- .setTitle('Verifizierung')
- .setDescription('Use ☑️ to get Member-Rank\n'
- +'INSERT TEXT HERE\n\n')
- .setTimestamp();
- let messageEmbed = await message.channel.send(embed);
- messageEmbed.react(yellowTeamEmoji);
- client.on('messageReactionAdd', async (reaction, user) => {
- if (reaction.message.partial) await reaction.message.fetch();
- if (reaction.partial) await reaction.fetch();
- if (user.bot) return;
- if (!reaction.message.guild) return;
- if (reaction.message.channel.id == channel) {
- if (reaction.emoji.name === yellowTeamEmoji) {
- await reaction.message.guild.members.cache.get(user.id).roles.add(yellowTeamRole);
- await reaction.message.guild.members.cache.get(user.id).roles.remove(blueTeamRole);
- }
- } else {
- return;
- }
- });
- client.on('messageReactionRemove', async (reaction, user) => {
- if (reaction.message.partial) await reaction.message.fetch();
- if (reaction.partial) await reaction.fetch();
- if (user.bot) return;
- if (!reaction.message.guild) return;
- if (reaction.message.channel.id == channel) {
- if (reaction.emoji.name === yellowTeamEmoji) {
- await reaction.message.guild.members.cache.get(user.id).roles.remove(yellowTeamRole);
- await reaction.message.guild.members.cache.get(user.id).roles.add(blueTeamRole);
- }
- } else {
- return;
- }
- });
- } else(message.reply("You have no permissions!"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement