Package discord4j.voice
Class LocalVoiceConnectionRegistry
- java.lang.Object
-
- discord4j.voice.LocalVoiceConnectionRegistry
-
- All Implemented Interfaces:
VoiceConnectionRegistry
public class LocalVoiceConnectionRegistry extends Object implements VoiceConnectionRegistry
A simpleVoiceConnectionRegistrythat tracks localVoiceConnectioninstances.
-
-
Constructor Summary
Constructors Constructor Description LocalVoiceConnectionRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<Void>disconnect(Snowflake guildId)Disconnect aVoiceConnectionfor givenguildIdand remove it from the registry.Mono<VoiceConnection>getVoiceConnection(Snowflake guildId)Return the currentVoiceConnectionthis registry holds for a givenguildId.Mono<Void>registerVoiceConnection(Snowflake guildId, VoiceConnection voiceConnection)Register aVoiceConnectionfor a givenguildId, replacing any existing one.
-
-
-
Method Detail
-
getVoiceConnection
public Mono<VoiceConnection> getVoiceConnection(Snowflake guildId)
Description copied from interface:VoiceConnectionRegistryReturn the currentVoiceConnectionthis registry holds for a givenguildId.- Specified by:
getVoiceConnectionin interfaceVoiceConnectionRegistry- Parameters:
guildId- the guild ID to fetch the current voice connection- Returns:
- a
MonoofVoiceConnectionfor the given guild if present, empty otherwise.
-
registerVoiceConnection
public Mono<Void> registerVoiceConnection(Snowflake guildId, VoiceConnection voiceConnection)
Description copied from interface:VoiceConnectionRegistryRegister aVoiceConnectionfor a givenguildId, replacing any existing one.- Specified by:
registerVoiceConnectionin interfaceVoiceConnectionRegistry- 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
public Mono<Void> disconnect(Snowflake guildId)
Description copied from interface:VoiceConnectionRegistryDisconnect aVoiceConnectionfor givenguildIdand remove it from the registry. If no connection was present for the guild, this method does nothing.- Specified by:
disconnectin interfaceVoiceConnectionRegistry- Parameters:
guildId- the guild ID to disconnect and remove a voice connection- Returns:
- a
Monoindicating completion of the disconnection process, if an error happens it is emitted through theMono.
-
-