nyx/commands/Moderation/unban.js
2021-06-24 15:53:19 +08:00

30 lines
1,018 B
JavaScript

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)
.setFooter(
message.member.displayName || message.author.username,
message.author.displayAvatarURL({ dynamic: true })
)
.setThumbnail(client.user.displayAvatarURL())
.setColor(client.color)
.setTimestamp();
message.inlineReply(embed);
} catch (e) {
console.log(e);
return client.err(message, "Moderation", "unban", 999);
}
},
};