Getting existing audio player
how do i get the audio player in a guild if any?
23 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Audio players are not specific to guilds, you can have many connections (across several guilds) subscribed to the same player
like i'm making a djs voice events handler but i create the player in the file where it is used,
could i just do like and it'll be good to go for handling the events?
Why would you need a handler for player events?
like for the queue system when the player gets idle i check if there's any song in the queue and then play it
I just register the events the normal way after creating the player
Are you registering 20 events per player or smth?
wdym?
player.on("idle", …).on("error", …)
can i like create the player initially and export it and can use it?
Why would you do that?
You want the same thing to play in every guild?
no no lol
Then no, you can’t do that
like i just need to use the events to do different things but like i create the player in the
play.js
file then how would i use the player in other files?Either store it separately or use
connection.state.player
connection is obtainable by getVoiceConnection(guildId)oh that returns the player?
Assuming the connection is subscribed to the player
hmm got it, i subscribe the player like this: it's ok right
Yea
Oop, forgot .subscription
connection.state.subscription.player
oh
._.
Yea, not rly a big fan of it tbh
hmm
mmh
hey btw, what event should i use for getting the guild id