Files
synapse/src/events/guild/guildDelete.ts
T
2026-08-27 22:38:58 +08:00

21 lines
758 B
TypeScript

import { CommandClient, Event, Guild } from "athena-prime";
import { deleteConfiguration } from "../../utils/database";
// ----------
class GuildDeleteEvent extends Event<CommandClient> {
event: string = 'guildDelete' as const;
async handle(context: CommandClient<any, any>, guild: Guild | { id: string }) {
// TODO: Instead, it might be safer to have the configuration be marked for deletion instead.
// This would prevent the config from being removed if the server owner decides re-adding
// the bot is a smart move.
//
// For simplicity, I'm keeping it like this. In the future this will be handled by
// a scheduled task.
await deleteConfiguration(guild.id);
}
}
export default new GuildDeleteEvent('guildDelete');