Method ConnectAsync
| Improve this Doc View SourceConnectAsync(Snowflake, bool, bool, TimeSpan?, CancellationToken?)
Initiates this voice connection and connects to a voice channel.
Declaration
public Task ConnectAsync(Snowflake voiceChannelId, bool startMute = false, bool startDeaf = false, TimeSpan? connectionTimeout = null, CancellationToken? cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Snowflake | voiceChannelId | The voice channel to connect to. Must be in the guild that this connection is for. |
| bool | startMute | Whether the current bot should connect self-muted. |
| bool | startDeaf | Whether the current bot should connect self-deafened. |
| TimeSpan? | connectionTimeout | The maximum amount of time to wait for connection to complete before timing out. Defaults to 60 seconds. |
| CancellationToken? | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if connect is called more than once or if the parent Gateway connection is not valid. |
| OperationCanceledException | Thrown if the give cancellation token is cancelled, the Gateway connection is closed while initiating the voice connection,
or if the |