Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const discord = require("discord.js");
  2.  
  3. module.exports.run = async (bot, message, args) => {
  4.  
  5.   if (message.member.hasPermission("BAN_MEMBERS")) {
  6.  
  7.       if (!message.mentions.users) return message.reply('You must tag 1 user.');
  8.  
  9.       else {
  10.  
  11.           const channel = message.guild.channels.cache.get("696692048543088691");
  12.           const member = message.mentions.users.first()
  13.           let reason = message.content.split(" ").slice(2).join(' ');
  14.  
  15.           if (member.bannable == false) return message.channel.send("That user cannot be baned!");
  16.  
  17.           else {
  18.  
  19.               if (!reason) reason = (`No reason provided.`);
  20.  
  21.               await member.send(`You have been baned from **${message.guild.name}** with the reason: **${reason}**`)
  22.                   .catch(err => message.channel.send(`⚠ Unable to contact **${member}**.`));
  23.  
  24.               await member.ban(reason);
  25.  
  26.               const banEmbed = new discord.MessageEmbed()
  27.                   // .setAuthor(member.user.tag, member.user.iconURL()) -> kleine avatar
  28.                   .setAuthor(member.user.avatarURL())
  29.                   .setThumbnail(member.user.avatarURL())
  30.                   .setAuthor(member.user.tag)
  31.                   .setColor("#ee0000")
  32.                   .setTimestamp()
  33.                   .addField("Kicked By", message.author.tag)
  34.                   .addField("Reason", reason);
  35.                   // console.log(member.user.avatarURL('Heeft geen avatar'))
  36.  
  37.               await channel.send(banEmbed);
  38.  
  39.               console.log(`${message.author.tag} Baned ${member.user.tag} from '${message.guild.name}' with the reason: '${reason}'.`);
  40.  
  41.           }
  42.       }
  43.   } else {
  44.       message.channel.send("You do not have permission to use the ban command.");
  45.       return;
  46.   }
  47. }
  48.  
  49.  
  50. module.exports.help = {
  51.   name: "banuser"
  52. }
  53.  
  54. /* module.exports.run = async (bot, message, args) => {
  55.  
  56.     if (!message.member.hasPermission("BAN_MEMBERS") || !message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("You don't have a permissions to do this.");
  57.     let user = message.mentions.users.first();
  58.    
  59.     let member = message.guild.member(user);
  60.     let reason = args.slice(22).join(" ");
  61.    
  62.     if (!user) return message.channel.send("Please mention the user.");
  63.     if (user.id === message.author.id) return message.channel.send("You can't ban yourself.");
  64.     if (user.id === client.user.id) return message.channel.send("You can't ban me.");
  65.    
  66.     if (!reason) reason = "No reason provided";
  67.    
  68.     member.ban(reason).then(() => {
  69.       message.channel.send(`Successfully banned **${user.tag}**`);
  70.     }).catch(err => {
  71.       message.reply("I was unable to ban the member.");
  72.     })
  73. }
  74. module.exports.help = {
  75.     name: "banuser"
  76. } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement