Discore
Show / Hide Table of Contents

Class Shard

Inheritance
object
Shard
Implements
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Discore.WebSocket
Assembly: Discore.dll
Syntax
public class Shard : IDisposable

Constructors

Name Description
Shard(string, int, int)

Creates a new Discord WebSocket shard.

Properties

Name Description
Gateway

Gets the gateway manager for this shard.

Id

Gets the ID of this shard.

IsRunning

Gets whether this shard is currently running.

UserId

Gets the ID of the user used to authenticate this shard connection. Or null if the gateway is not currently connected.

Methods

Name Description
Dispose()
StartAsync(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.

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.

StopAsync()

Stop this shard.

WaitUntilStoppedAsync(CancellationToken?)

Returns a task that completes when this shard is stopped either normally or from an error.

Events

Name Description
OnConnected

Called when this shard first connects to the Discord Gateway.

OnDisconnected

Called when this shard disconnects from the Discord Gateway for any reason.

If a shard failure is the cause, OnFailure will be fired right before this event.
OnFailure

Called when this shard fails and cannot reconnect due to the error.

OnReconnected

Called when the internal connection of this shard reconnected to the Discord Gateway.

This can be used to reset things such as the user presence, which is cleared when a new session has been created. This event will always be fired before Gateway OnReady.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX