nyx/commands/Moderation/unban.js

31 lines
1,012 B
JavaScript
Raw Normal View History

2021-06-12 12:53:51 +02:00
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "unban",
description: "Unban an user",
UserPerm: "BAN_MEMBERS",
BotPerm: "BAN_MEMBERS",
usage: "(User)",
category: "Moderation",
run: async (client, message, args) => {
try {
if (!args[0]) return client.err(message, "Moderation", "unban", 1);
const user = await message.guild.members.unban(args[0]);
const embed = new MessageEmbed()
.setTitle("User Unbanned")
.addField("**Moderator**", message.author.tag, true)
.addField("**User**", user.tag, true)
2021-06-12 12:53:51 +02:00
.setFooter(
message.member.displayName || message.author.username,
message.author.displayAvatarURL({ dynamic: true })
)
.setThumbnail(client.user.displayAvatarURL())
.setColor(client.color)
.setTimestamp();
2021-09-06 12:38:25 +02:00
message.reply(embed);
2021-06-12 12:53:51 +02:00
} catch (e) {
console.log(e);
return client.err(message, "Moderation", "unban", 999);
}
},
};