2024-01-28 17:33:22 +00:00
|
|
|
import { Events } from 'discord.js';
|
|
|
|
|
|
|
|
export const name = Events.VoiceStateUpdate;
|
|
|
|
export async function execute(oldState, newState) {
|
|
|
|
console.debug('[DEBUG] Voice State Update');
|
|
|
|
|
2024-02-06 15:18:06 +00:00
|
|
|
const change = !!oldState.channel ^ !!newState.channel;
|
2024-01-28 17:33:22 +00:00
|
|
|
if (!change) return;
|
|
|
|
|
|
|
|
const guild = newState.guild.name;
|
|
|
|
const member = newState.member.user.username;
|
|
|
|
const state = newState.channel ? 'joined' : 'left';
|
|
|
|
const channel = (oldState.channel ?? newState.channel).name;
|
|
|
|
|
|
|
|
console.debug(`[DEBUG] User '${member}' ${state} channel '${channel}' in guild '${guild}'.`);
|
|
|
|
}
|