-
-
Notifications
You must be signed in to change notification settings - Fork 95
Handling Discord.js Events
Skick edited this page Jun 8, 2024
·
3 revisions
There are a few ways to handle discord.js events
import { isVoiceChannelEmpty } from "distube";
client.on("voiceStateUpdate", oldState => {
if (!oldState?.channel) return;
const voice = this.voices.get(oldState);
if (voice && isVoiceChannelEmpty(oldState)) {
voice.leave();
}
});
import { isVoiceChannelEmpty } from "distube";
client.on("voiceStateUpdate", oldState => {
if (!oldState?.channel) return;
const queue = this.queues.get(oldState);
if (!queue) return;
if (isVoiceChannelEmpty(oldState)) {
queue.pause();
} else if (queue.paused) {
queue.resume();
}
});