Advertisement
jensie1996

Ban & unban embes discord.js

Jul 1st, 2022 (edited)
730
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let role = await interaction.guild.roles.cache.find(r => r.name.toLowerCase() === "staff");
  2. if (!interaction.member.roles.cache.has(role.id)) return interaction.reply("Error: Alleen toegankelijk voor staff.");
  3.  
  4. const member = interaction.options.getMember('user');
  5. if (member.roles.cache.has(role.id)) return interaction.reply("Deze persoon kan je niet bannen.");
  6.  
  7. // embed aanmaken ban.js.
  8. const embed = new MessageEmbed()
  9.     .setColor("#FF0000")
  10.     .setDescription(`**Member:** ${member.user.tag} (${member.user.id})\n**Actie:** Ban\n**Reden:** ${reason}`)
  11.     .setTimestamp();
  12.  
  13. // verzenden embed in privé berichten.
  14. await member.send(`**The BelgiumGames**\nJe bent verbannen uit onze Discord.\n\n**Reden:** ${reason}`).catch(() => {
  15.     interaction.channel.send(`**${member.user.tag}** heeft zijn/haar privé berichten uitstaan, en heeft dus geen bericht ontvangen.`)
  16. });
  17.  
  18.  
  19. // Embed aanmaken Unban.js.
  20. let embed = new MessageEmbed()
  21.     .setColor("#03c450")
  22.     .setDescription(`**Member: **${member.user.username}#${member.user.discriminator} (${member.user.id})\n**Actie: ** Unban`)
  23.     .setTimestamp();
  24.  
  25. await interaction.reply(`**${member.user.username}#${member.user.discriminator}** is unbanned.`);
  26. await interaction.guild.channels.cache.find(c => c.name.toLowerCase() == "log").send({ embeds: [embed] });
  27.  
Advertisement
RAW Paste Data Copied
Advertisement