Method StartAsync
| Improve this Doc View SourceStartAsync(GatewayIntent, CancellationToken?)
Starts this shard. The returned task only finishes once the gateway successfully connects (or is canceled), and will continue to retry until then.
Declaration
public Task StartAsync(GatewayIntent intents, CancellationToken? cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GatewayIntent | intents | A bitwise OR of Gateway event groups to subscribe to. Gateway events in groups that are not specified here will never be fired. For example, to receive 'MessageCreate' events for guild messages, specify GuildMessages. |
| CancellationToken? | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if this shard has already been started. |
| ObjectDisposedException | Thrown if this shard has been disposed. |
| OperationCanceledException | |
| ShardStartException | Thrown if the shard fails to start. |
StartAsync(ShardStartConfig, CancellationToken?)
Starts this shard. The returned task only finishes once the gateway successfully connects (or is canceled), and will continue to retry until then.
Declaration
public Task StartAsync(ShardStartConfig config, CancellationToken? cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ShardStartConfig | config | A set of options to use when starting the shard. |
| CancellationToken? | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if config is null. |
| InvalidOperationException | Thrown if this shard has already been started. |
| ObjectDisposedException | Thrown if this shard has been disposed. |
| OperationCanceledException | |
| ShardStartException | Thrown if the shard fails to start. |