generated from Baipyrus/DiscordJS-Template
ignore if channel is unregistered
This commit is contained in:
parent
d212ca398a
commit
a29e2074a5
@ -1,9 +1,18 @@
|
||||
import { ChannelType, Events, PermissionsBitField } from 'discord.js';
|
||||
import { VoiceChannel } from '../../database.js';
|
||||
|
||||
export const name = Events.VoiceStateUpdate;
|
||||
export async function execute(_, state) {
|
||||
if (!state.channel) return;
|
||||
|
||||
// Find channel by id, return if not registered for customs
|
||||
const channel = await VoiceChannel.findOne({
|
||||
where: {
|
||||
id: state.channel.id
|
||||
}
|
||||
});
|
||||
if (channel === null) return;
|
||||
|
||||
// Extract user data
|
||||
const member = state.member;
|
||||
const name = member.user.username;
|
||||
|
Loading…
Reference in New Issue
Block a user