2024-02-11 01:04:12 +00:00
|
|
|
import { ChannelType, Events, GuildChannel } from 'discord.js';
|
2024-02-08 20:11:56 +00:00
|
|
|
import { VoiceChannel } from '../../database.js';
|
|
|
|
|
|
|
|
export const name = Events.ChannelDelete;
|
2024-02-11 01:04:12 +00:00
|
|
|
/** @param {GuildChannel} channel */
|
2024-02-08 20:11:56 +00:00
|
|
|
export async function execute(channel) {
|
2024-02-09 15:30:58 +00:00
|
|
|
if (channel.type !== ChannelType.GuildVoice) return;
|
|
|
|
|
2024-02-08 20:11:56 +00:00
|
|
|
// Delete channel entry once channel is deleted itself
|
|
|
|
const count = await VoiceChannel.destroy({
|
|
|
|
where: {
|
|
|
|
id: channel.id
|
|
|
|
}
|
|
|
|
});
|
2024-02-09 15:30:58 +00:00
|
|
|
if (count > 0) console.info(`[INFO] Custom VC entry with ID '${channel.id}' was destroyed.`);
|
2024-02-08 20:11:56 +00:00
|
|
|
}
|