Package discord4j.voice
Interface VoiceConnectionRegistry
- All Known Implementing Classes:
LocalVoiceConnectionRegistry
A centralized registry to hold
VoiceConnection instances.-
Method Summary
Modifier and TypeMethodDescriptiondisconnect(Snowflake guildId) Disconnect aVoiceConnectionfor givenguildIdand remove it from the registry.getVoiceConnection(Snowflake guildId) Return the currentVoiceConnectionthis registry holds for a givenguildId.registerVoiceConnection(Snowflake guildId, VoiceConnection voiceConnection) Register aVoiceConnectionfor a givenguildId, replacing any existing one.
-
Method Details
-
getVoiceConnection
Return the currentVoiceConnectionthis registry holds for a givenguildId.- Parameters:
guildId- the guild ID to fetch the current voice connection- Returns:
- a
MonoofVoiceConnectionfor the given guild if present, empty otherwise.
-
registerVoiceConnection
Register aVoiceConnectionfor a givenguildId, replacing any existing one.- Parameters:
guildId- the guild ID to set the new voice connectionvoiceConnection- theVoiceConnectionto register- Returns:
- a
Monoindicating completion of the registration process, if an error happens it is emitted through theMono.
-
disconnect
Disconnect aVoiceConnectionfor givenguildIdand remove it from the registry. If no connection was present for the guild, this method does nothing.
-