Class NodeExtensions
- Namespace
- Nyra.DSharpPlus
- Assembly
- Nyra.DSharpPlus.dll
Nyra entry points that need DSharpPlus channel types.
public static class NodeExtensions
- Inheritance
-
NodeExtensions
- Inherited Members
Methods
ConnectAsync(Node, DiscordChannel, CancellationToken)
Creates the guild connection on the node and joins the bot to the voice channel.
public static Task<GuildConnection> ConnectAsync(this Node node, DiscordChannel channel, CancellationToken cancellationToken = default)
Parameters
nodeNodeThe node to connect through.
channelDiscordChannelThe voice channel to join. A stage channel joins as audience.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GuildConnection>
The guild connection of the join, the existing one when its registry entry is still live.
Remarks
A stage channel joins the bot as audience, Nyra sends no request to speak, so audio only reaches it once a stage moderator unsuppresses the bot. A join for a channel with a live connection returns that connection, one racing a disconnect takes over the dying connection and returns a fresh one.
Exceptions
- ArgumentNullException
nodeorchannelis null.- ArgumentException
The channel is not a voice or stage channel, or does not belong to a guild.
- ArgumentOutOfRangeException
The channel's guild id or channel id is zero.
- ObjectDisposedException
The node was disposed.
- InvalidOperationException
The node is not started and ready yet, or the guild is already connected to another channel or through a different node, disconnect it before connecting again.
- VoiceHandshakeException
The voice handshake of the join failed, see its message for the cause.
- NodeUnreachableException
The node became unreachable between the handshake and the player registration.
- TimeoutException
The node's REST endpoint did not answer the player registration within its bound.
- RestException
The node rejected the player registration, see its message for the reply.
- OperationCanceledException
The join was cancelled through the token.