2020-12-31 16:10:56 +00:00
|
|
|
import Event from "../core/event";
|
|
|
|
import $ from "../core/lib";
|
|
|
|
import {updateGlobalEmoteRegistry} from "../core/lib";
|
2021-04-03 04:11:18 +00:00
|
|
|
import {client} from "../index";
|
|
|
|
import {Config} from "../core/structures";
|
|
|
|
import {TextChannel} from "discord.js";
|
2020-12-31 16:10:56 +00:00
|
|
|
|
|
|
|
export default new Event<"guildDelete">({
|
2021-04-01 13:41:49 +00:00
|
|
|
on(guild) {
|
|
|
|
$.log(`[GUILD LEAVE] ${guild.name} (${guild.id}) removed the bot. Updated emote registry.`);
|
2021-04-03 04:11:18 +00:00
|
|
|
|
|
|
|
if (Config.systemLogsChannel) {
|
|
|
|
const channel = client.channels.cache.get(Config.systemLogsChannel);
|
|
|
|
|
|
|
|
if (channel && channel.type === "text") {
|
|
|
|
(channel as TextChannel).send(`\`${guild.name}\` (\`${guild.id}\`) removed the bot.`);
|
|
|
|
} else {
|
|
|
|
console.warn(`${Config.systemLogsChannel} is not a valid text channel for system logs!`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-31 16:10:56 +00:00
|
|
|
updateGlobalEmoteRegistry();
|
|
|
|
}
|
|
|
|
});
|