Skip to content

Commit

Permalink
Added voiceStateUpdate event listener
Browse files Browse the repository at this point in the history
  • Loading branch information
SandwichBtw committed Nov 26, 2023
1 parent 1c9b568 commit 1d11005
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/modules/events/voiceStateUpdate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { type VoiceState, type VoiceBasedChannel } from "discord.js"
import { type Event } from "../../types/Event"
import { spawnPlayerConnection } from "../audio/audioPlayer"

module.exports = {
name: "voiceStateUpdate",
once: false,
rest: false,
execute: async function (oldState: VoiceState, newState: VoiceState) {
if (newState.member == null) {
console.log("member is null.")
return
}
if (newState.member.user.bot) {
console.log("user.bot is true.")
return
}

spawnPlayerConnection(newState.channel as VoiceBasedChannel, "fortnite.mp3")
},
} satisfies Event

0 comments on commit 1d11005

Please sign in to comment.