DiscordJS-Example/events/channels/channelDelete.js

16 lines
474 B
JavaScript
Raw Normal View History

2024-02-09 15:30:58 +00:00
import { ChannelType, Events } from 'discord.js';
2024-02-08 20:11:56 +00:00
import { VoiceChannel } from '../../database.js';
export const name = Events.ChannelDelete;
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
}