Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const discord = require("discord.js");
- module.exports.run = async (bot, message, args) => {
- if (message.member.hasPermission("BAN_MEMBERS")) {
- if (!message.mentions.users) return message.reply('You must tag 1 user.');
- else {
- const channel = message.guild.channels.cache.get("696692048543088691");
- const member = message.mentions.users.first()
- let reason = message.content.split(" ").slice(2).join(' ');
- if (member.bannable == false) return message.channel.send("That user cannot be baned!");
- else {
- if (!reason) reason = (`No reason provided.`);
- await member.send(`You have been baned from **${message.guild.name}** with the reason: **${reason}**`)
- .catch(err => message.channel.send(`⚠ Unable to contact **${member}**.`));
- await member.ban(reason);
- const banEmbed = new discord.MessageEmbed()
- // .setAuthor(member.user.tag, member.user.iconURL()) -> kleine avatar
- .setAuthor(member.user.avatarURL())
- .setThumbnail(member.user.avatarURL())
- .setAuthor(member.user.tag)
- .setColor("#ee0000")
- .setTimestamp()
- .addField("Kicked By", message.author.tag)
- .addField("Reason", reason);
- // console.log(member.user.avatarURL('Heeft geen avatar'))
- await channel.send(banEmbed);
- console.log(`${message.author.tag} Baned ${member.user.tag} from '${message.guild.name}' with the reason: '${reason}'.`);
- }
- }
- } else {
- message.channel.send("You do not have permission to use the ban command.");
- return;
- }
- }
- module.exports.help = {
- name: "banuser"
- }
- /* module.exports.run = async (bot, message, args) => {
- if (!message.member.hasPermission("BAN_MEMBERS") || !message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("You don't have a permissions to do this.");
- let user = message.mentions.users.first();
- let member = message.guild.member(user);
- let reason = args.slice(22).join(" ");
- if (!user) return message.channel.send("Please mention the user.");
- if (user.id === message.author.id) return message.channel.send("You can't ban yourself.");
- if (user.id === client.user.id) return message.channel.send("You can't ban me.");
- if (!reason) reason = "No reason provided";
- member.ban(reason).then(() => {
- message.channel.send(`Successfully banned **${user.tag}**`);
- }).catch(err => {
- message.reply("I was unable to ban the member.");
- })
- }
- module.exports.help = {
- name: "banuser"
- } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement