2024-02-06 21:45:53 +05:00
|
|
|
const BaseEvent = require("../../base/BaseEvent");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2022-07-23 17:14:42 +05:00
|
|
|
class GuildDelete extends BaseEvent {
|
|
|
|
constructor() {
|
|
|
|
super({
|
|
|
|
name: "guildDelete",
|
2022-12-15 21:02:38 +05:00
|
|
|
once: false,
|
2022-07-23 17:14:42 +05:00
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-08-02 17:18:47 +05:00
|
|
|
|
2022-07-23 17:14:42 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-07-23 17:14:42 +05:00
|
|
|
* @param {import("discord.js").Guild} guild
|
|
|
|
*/
|
2022-08-02 17:18:47 +05:00
|
|
|
async execute(client, guild) {
|
2024-02-06 21:45:53 +05:00
|
|
|
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(),
|
2024-02-06 21:45:53 +05:00
|
|
|
},
|
|
|
|
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}`);
|
2024-02-06 21:45:53 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-07-23 17:14:42 +05:00
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = GuildDelete;
|