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 aVoiceConnection
for givenguildId
and remove it from the registry.getVoiceConnection
(Snowflake guildId) Return the currentVoiceConnection
this registry holds for a givenguildId
.registerVoiceConnection
(Snowflake guildId, VoiceConnection voiceConnection) Register aVoiceConnection
for a givenguildId
, replacing any existing one.
-
Method Details
-
getVoiceConnection
Return the currentVoiceConnection
this registry holds for a givenguildId
.- Parameters:
guildId
- the guild ID to fetch the current voice connection- Returns:
- a
Mono
ofVoiceConnection
for the given guild if present, empty otherwise.
-
registerVoiceConnection
Register aVoiceConnection
for a givenguildId
, replacing any existing one.- Parameters:
guildId
- the guild ID to set the new voice connectionvoiceConnection
- theVoiceConnection
to register- Returns:
- a
Mono
indicating completion of the registration process, if an error happens it is emitted through theMono
.
-
disconnect
Disconnect aVoiceConnection
for givenguildId
and remove it from the registry. If no connection was present for the guild, this method does nothing.
-