Interface AudioChannel
- All Superinterfaces:
CategorizableChannel
,Channel
,DiscordObject
,Entity
,GuildChannel
,TopLevelGuildChannel
- All Known Implementing Classes:
StageChannel
,VoiceChannel
A Discord audio channel. This can be either a
StageChannel
or a VoiceChannel
.
This superclass contains the common audio methods for these two types.-
Nested Class Summary
Nested classes/interfaces inherited from interface discord4j.core.object.entity.channel.Channel
Channel.Flag, Channel.Type
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
Gets the bitrate (in bits) for this audio channel.default Region.Id
Gets the voice region id for the audio channel.default Mono<VoiceConnection>
Returns the current voice connection registered for this audio channel's guild.default Flux<VoiceState>
Requests to retrieve the voice states of this audio channel.isMemberConnected
(Snowflake memberId) Requests to determine if the member represented by the providedSnowflake
is connected to this audio channel.default discord4j.core.spec.AudioChannelJoinMono
join()
Request to join this audio channel upon subscription.default Mono<VoiceConnection>
join
(discord4j.core.spec.AudioChannelJoinSpec spec) Request to join this audio channel upon subscription.default Mono<VoiceConnection>
join
(Consumer<? super LegacyVoiceChannelJoinSpec> spec) Deprecated.sendConnectVoiceState
(boolean selfMute, boolean selfDeaf) Sends a join request to the gatewaySends a leave request to the gatewayMethods inherited from interface discord4j.core.object.entity.channel.CategorizableChannel
createInvite, createInvite, createInvite, getCategory, getCategory, getCategoryId, getInvites, getRateLimitPerUser
Methods inherited from interface discord4j.core.object.entity.channel.Channel
delete, delete, getData, getId, getMention, getRestChannel, getType
Methods inherited from interface discord4j.core.object.DiscordObject
getClient
Methods inherited from interface discord4j.core.object.entity.channel.GuildChannel
getEffectivePermissions, getEffectivePermissions, getGuild, getGuild, getGuildId, getName
Methods inherited from interface discord4j.core.object.entity.channel.TopLevelGuildChannel
addMemberOverwrite, addMemberOverwrite, addRoleOverwrite, addRoleOverwrite, getOverwriteForMember, getOverwriteForRole, getPermissionOverwrites, getPosition, getRawPosition
-
Method Details
-
getBitrate
default int getBitrate()Gets the bitrate (in bits) for this audio channel.- Returns:
- Gets the bitrate (in bits) for this audio channel.
-
getRtcRegion
Gets the voice region id for the audio channel.- Returns:
- The voice region id for the audio channel.
-
getVoiceStates
Requests to retrieve the voice states of this audio channel.- Returns:
- A
Flux
that continually emits thevoice states
of this audio channel. If an error is received, it is emitted through theFlux
.
-
join
Deprecated.usejoin(AudioChannelJoinSpec)
orjoin()
which offer an immutable approach to build specsRequest to join this audio channel upon subscription. The resultingVoiceConnection
will be available to you from theMono
but also through aVoiceConnectionRegistry
and can be obtained throughGatewayDiscordClient.getVoiceConnectionRegistry()
. Additionally, the resultingVoiceConnection
can be retrieved from the associated guild throughGuild.getVoiceConnection()
and throughgetVoiceConnection()
.- Parameters:
spec
- AConsumer
that provides a "blank"LegacyVoiceChannelJoinSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits aVoiceConnection
, indicating a connection to the channel has been established. If an error is received, it is emitted through theMono
.
-
join
default discord4j.core.spec.AudioChannelJoinMono join()Request to join this audio channel upon subscription. Properties specifying how to join this audio channel can be set via thewithXxx
methods of the returnedAudioChannelJoinMono
. The resultingVoiceConnection
will be available to you from theMono
but also through aVoiceConnectionRegistry
and can be obtained throughGatewayDiscordClient.getVoiceConnectionRegistry()
. Additionally, the resultingVoiceConnection
can be retrieved from the associated guild throughGuild.getVoiceConnection()
and throughgetVoiceConnection()
.- Returns:
- A
AudioChannelJoinMono
where, upon successful completion, emits aVoiceConnection
, indicating a connection to the channel has been established. If an error is received, it is emitted through theAudioChannelJoinMono
.
-
join
Request to join this audio channel upon subscription. The resultingVoiceConnection
will be available to you from theMono
but also through aVoiceConnectionRegistry
and can be obtained throughGatewayDiscordClient.getVoiceConnectionRegistry()
. Additionally, the resultingVoiceConnection
can be retrieved from the associated guild throughGuild.getVoiceConnection()
and throughgetVoiceConnection()
.- Parameters:
spec
- an immutable object that specifies how to join this audio channel- Returns:
- A
Mono
where, upon successful completion, emits aVoiceConnection
, indicating a connection to the channel has been established. If an error is received, it is emitted through theMono
.
-
sendConnectVoiceState
Sends a join request to the gatewayThis method does not trigger any logic and requires external state handling
- Parameters:
selfMute
- if the client should be mutesselfDeaf
- if the client should be deaf- Returns:
- An empty mono which completes when the payload was sent to the gateway
-
sendDisconnectVoiceState
Sends a leave request to the gatewayThis method does not replace
VoiceConnection.disconnect()
when the channel was joined by usingjoin(AudioChannelJoinSpec)
- Returns:
- An empty mono which completes when the payload was sent to the gateway
-
isMemberConnected
Requests to determine if the member represented by the providedSnowflake
is connected to this audio channel. -
getVoiceConnection
Returns the current voice connection registered for this audio channel's guild.- Returns:
- A
Mono
ofVoiceConnection
for this audio channel's guild if present, or empty otherwise. The resultingMono
will also complete empty if the registered voice connection is not associated with this audio channel.
-
join(AudioChannelJoinSpec)
orjoin()
which offer an immutable approach to build specs