JaBa/events/Guild/guildBanAdd.js

33 lines
663 B
JavaScript

const BaseEvent = require("../../base/BaseEvent");
class guildBanAdd extends BaseEvent {
constructor() {
super({
name: "guildBanAdd",
once: false,
});
}
/**
*
* @param {import("../../base/Client")} client
* @param {import("discord.js").GuildBan} ban
*/
async execute(client, ban) {
const embed = client.embed({
author: {
name: client.user.getUsername(),
iconURL: ban.guild.iconURL(),
},
description: `You were banned from **${ban.guild.name}**!\nReason: **${ban.reason || "Not specified"}**`,
});
try {
await ban.user.send({
embeds: [embed],
});
} catch (e) { /**/ }
}
}
module.exports = guildBanAdd;