-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added voiceStateUpdate event listener
- Loading branch information
1 parent
1c9b568
commit 1d11005
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |