JaBa/events/Guild/guildDelete.js

38 lines
822 B
JavaScript
Raw Normal View History

const BaseEvent = require("../../base/BaseEvent");
2022-01-04 02:18:28 +05:00
class GuildDelete extends BaseEvent {
constructor() {
super({
name: "guildDelete",
once: false,
});
2022-01-04 02:18:28 +05:00
}
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
* @param {import("discord.js").Guild} guild
*/
async execute(client, guild) {
if (client.config.support.logs) {
const embed = client.embed({
author: {
name: guild.name,
2024-09-20 22:48:40 +05:00
iconURL: guild.iconURL() || client.user.avatarURL(),
},
description: `Left from guild **${guild.name}**.`,
});
2024-10-03 11:07:02 +05:00
const logChannel = client.channels.cache.get(client.config.support.logs);
if (logChannel)
await logChannel.send({
embeds: [embed],
});
else client.logger.warn(`Log channel not found for guild deletion: ${guild.name}`);
}
2022-01-04 02:18:28 +05:00
}
}
2023-07-05 00:58:06 +05:00
module.exports = GuildDelete;