Hey there! I found out that your ban.js has a lot of errors on it, but however, I managed to fix it up and it should have very little (or no) problems. If it does, just reply and I'll try to fix it
Also, this is mainly part of your bot, and because of that, I will be adding your credit on my GitHub repo and the bot itself (yes, it would have changes but I'll try not to hurt your copyright lol)
Here is the code btw:
const { MessageEmbed } = require('discord.js');
const config = require('../../configs/config.json');
module.exports = {
config: {
name: 'ban',
description: 'Ban a member from your server!',
usage: '<@user> [reason]',
accessableby: "Moderators",
category: "Moderation",
},
run: async (client, message, args) => { if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.reply('I don\'t have the ban members permission.') if(!message.member.hasPermission("BAN_MEMBERS")) return message.reply('You don\'t have the ban members permission.')
const noargs = new MessageEmbed()
.addField("Error!", "```diff\n- You didn\'t mention a user.```")
.addField("Usage", `\`\`\`diff\n+ ${config.prefix}ban [user] (reason)\`\`\``)
.setColor(config.embedcolor)
if (!args[0]) return message.channel.send(noargs)
let banMember = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(r => r.user.username.toLowerCase() === args[0].toLocaleLowerCase()) || message.guild.members.cache.find(ro => ro.displayName.toLowerCase() === args[0].toLocaleLowerCase());
const nomember = new MessageEmbed()
.addField("Error!", "```diff\n- I couldn't find that user.```")
.addField("Try", "```diff\n+ Check if that user is in this server, and rerun the command again.```")
.setColor(config.embedcolor)
const selfban = new MessageEmbed()
.addField("Error!", "```diff\n- You can't ban yourself!```")
.addField("Try", "```diff\n+ I do NOT allow the use of selfharm!```")
.setColor(config.embedcolor)
if (!banMember) return message.channel.send(nomember);
if (banMember === message.member) return message.channel.send(selfban)
var reason = args.slice(1).join(" ");
const unbannable = new MessageEmbed() .addField("Error!", "```diff\n- Nice try!```") .addField("Try", "```diff\n+ You can't ban a user with a role that's higher then you!```") .setColor(config.embedcolor)
if (!banMember.bannable) return message.channel.send(unbannable)
try {
const userbanned = new MessageEmbed()
.addField("Banned!", `\`\`\`diff\n- You got banned from ${message.guild.name}!\`\`\``)
.addField("Reason", `\`\`\`diff\n+ ${reason || "None."}!\`\`\``)
.addField("Moderator", `\`\`\`diff\n+ ${message.author.tag}!\`\`\``)
.setColor(config.embedcolor)
banMember.send(userbanned).then(() =>
message.guild.members.ban(banMember, { days: 7, reason: reason })).catch(() => null)
} catch {
message.guild.members.ban(banMember, { days: 7, reason: reason })
}
if (reason) {
var sembed = new MessageEmbed()
.addField("Success!", `\`\`\`diff\n+ ${banMember.user.tag} - [${banMember.user.id}] was banned\`\`\``)
.addField("Reason", `\`\`\`diff\n+ ${reason || "None."}!\`\`\``)
.setColor(config.embedcolor)
message.channel.send(sembed)
} else {
var sembed2 = new MessageEmbed()
.addField("Success!", `\`\`\`diff\n+ ${banMember.user.tag} - [${banMember.user.id}] was banned\`\`\``)
.setColor(config.embedcolor)
message.channel.send(sembed2)
}
}}`
I also made a kick.js command from the ban.js, but replaced it all with kick stuff. I hope you enjoy <3