Show / Hide Table of Contents

# Class DiscordShardedClient

##### Inheritance

System.Object
BaseDiscordClient
BaseSocketClient
DiscordShardedClient

##### Implements

IDiscordClient
System.IDisposable

##### Inherited Members

BaseSocketClient.BaseConfig
BaseSocketClient.CurrentUser
BaseSocketClient.CreateGuildAsync(String, IVoiceRegion, Stream, RequestOptions)
BaseSocketClient.GetConnectionsAsync(RequestOptions)
BaseSocketClient.GetInviteAsync(String, RequestOptions)
BaseSocketClient.ChannelCreated
BaseSocketClient.ChannelDestroyed
BaseSocketClient.ChannelUpdated
BaseSocketClient.MessageReceived
BaseSocketClient.MessageDeleted
BaseSocketClient.MessagesBulkDeleted
BaseSocketClient.MessageUpdated
BaseSocketClient.ReactionAdded
BaseSocketClient.ReactionRemoved
BaseSocketClient.ReactionsCleared
BaseSocketClient.RoleCreated
BaseSocketClient.RoleDeleted
BaseSocketClient.RoleUpdated
BaseSocketClient.JoinedGuild
BaseSocketClient.LeftGuild
BaseSocketClient.GuildAvailable
BaseSocketClient.GuildUnavailable
BaseSocketClient.GuildMembersDownloaded
BaseSocketClient.GuildUpdated
BaseSocketClient.UserJoined
BaseSocketClient.UserLeft
BaseSocketClient.UserBanned
BaseSocketClient.UserUnbanned
BaseSocketClient.UserUpdated
BaseSocketClient.GuildMemberUpdated
BaseSocketClient.UserVoiceStateUpdated
BaseSocketClient.VoiceServerUpdated
BaseSocketClient.CurrentUserUpdated
BaseSocketClient.UserIsTyping
BaseSocketClient.RecipientAdded
BaseSocketClient.RecipientRemoved
BaseDiscordClient.Log
BaseDiscordClient.LoggedIn
BaseDiscordClient.LoggedOut
BaseDiscordClient.LoginState
BaseDiscordClient.TokenType
BaseDiscordClient.LoginAsync(TokenType, String, Boolean)
BaseDiscordClient.LogoutAsync()
BaseDiscordClient.Dispose()
BaseDiscordClient.GetRecommendedShardCountAsync(RequestOptions)
BaseDiscordClient.IDiscordClient.ConnectionState
BaseDiscordClient.IDiscordClient.CurrentUser
BaseDiscordClient.IDiscordClient.GetDMChannelsAsync(CacheMode, RequestOptions)
BaseDiscordClient.IDiscordClient.GetGroupChannelsAsync(CacheMode, RequestOptions)
BaseDiscordClient.IDiscordClient.GetWebhookAsync(UInt64, RequestOptions)
BaseDiscordClient.IDiscordClient.StartAsync()
BaseDiscordClient.IDiscordClient.StopAsync()
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Discord.WebSocket

###### Assembly: Discord.Net.WebSocket.dll

##### Syntax

    public class DiscordShardedClient : BaseSocketClient, IDiscordClient, IDisposable

### Constructors

| Improve this Doc View Source

#### DiscordShardedClient()

Creates a new REST/WebSocket Discord client.

##### Declaration

    public DiscordShardedClient()

| Improve this Doc View Source

#### DiscordShardedClient(DiscordSocketConfig)

Creates a new REST/WebSocket Discord client.

##### Declaration

    public DiscordShardedClient(DiscordSocketConfig config)

##### Parameters

Type | Name | Description
--- | --- | ---
DiscordSocketConfig | config |

| Improve this Doc View Source

#### DiscordShardedClient(Int32[])

Creates a new REST/WebSocket Discord client.

##### Declaration

    public DiscordShardedClient(int[] ids)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32[] | ids |

| Improve this Doc View Source

#### DiscordShardedClient(Int32[], DiscordSocketConfig)

Creates a new REST/WebSocket Discord client.

##### Declaration

    public DiscordShardedClient(int[] ids, DiscordSocketConfig config)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32[] | ids |
DiscordSocketConfig | config |

### Properties

| Improve this Doc View Source

#### Activity

##### Declaration

    public override IActivity Activity { get; protected set; }

##### Property Value

Type | Description
--- | ---
IActivity |

##### Overrides

BaseSocketClient.Activity
| Improve this Doc View Source

#### Guilds

##### Declaration

    public override IReadOnlyCollection<SocketGuild> Guilds { get; }

##### Property Value

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<SocketGuild> |

##### Overrides

BaseSocketClient.Guilds
| Improve this Doc View Source

#### Latency

##### Declaration

    public override int Latency { get; protected set; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

##### Overrides

BaseSocketClient.Latency
| Improve this Doc View Source

#### PrivateChannels

##### Declaration

    public override IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels { get; }

##### Property Value

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<ISocketPrivateChannel> |

##### Overrides

BaseSocketClient.PrivateChannels
| Improve this Doc View Source

#### Rest

Provides access to a REST-only client with a shared state from this client.

##### Declaration

    public override DiscordSocketRestClient Rest { get; }

##### Property Value

Type | Description
--- | ---
DiscordSocketRestClient |

##### Overrides

BaseSocketClient.Rest
| Improve this Doc View Source

#### Shards

##### Declaration

    public IReadOnlyCollection<DiscordSocketClient> Shards { get; }

##### Property Value

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<DiscordSocketClient> |

| Improve this Doc View Source

#### Status

##### Declaration

    public override UserStatus Status { get; protected set; }

##### Property Value

Type | Description
--- | ---
UserStatus |

##### Overrides

BaseSocketClient.Status
| Improve this Doc View Source

#### VoiceRegions

##### Declaration

    public override IReadOnlyCollection<RestVoiceRegion> VoiceRegions { get; }

##### Property Value

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<RestVoiceRegion> |

##### Overrides

BaseSocketClient.VoiceRegions

### Methods

| Improve this Doc View Source

#### DownloadUsersAsync(IEnumerable<IGuild>)

##### Declaration

    public override Task DownloadUsersAsync(IEnumerable<IGuild> guilds)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.IEnumerable<IGuild> | guilds |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

BaseSocketClient.DownloadUsersAsync(IEnumerable<IGuild>)

##### Exceptions

Type | Condition
--- | ---
System.ArgumentNullException | `guilds` is null

| Improve this Doc View Source

#### GetApplicationInfoAsync(RequestOptions)

##### Declaration

    public override Task<RestApplication> GetApplicationInfoAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<RestApplication> |

##### Overrides

BaseSocketClient.GetApplicationInfoAsync(RequestOptions)
| Improve this Doc View Source

#### GetChannel(UInt64)

##### Declaration

    public override SocketChannel GetChannel(ulong id)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |

##### Returns

Type | Description
--- | ---
SocketChannel |

##### Overrides

BaseSocketClient.GetChannel(UInt64)
| Improve this Doc View Source

#### GetGuild(UInt64)

##### Declaration

    public override SocketGuild GetGuild(ulong id)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |

##### Returns

Type | Description
--- | ---
SocketGuild |

##### Overrides

BaseSocketClient.GetGuild(UInt64)
| Improve this Doc View Source

#### GetShard(Int32)

##### Declaration

    public DiscordSocketClient GetShard(int id)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | id |

##### Returns

Type | Description
--- | ---
DiscordSocketClient |

| Improve this Doc View Source

#### GetShardFor(IGuild)

##### Declaration

    public DiscordSocketClient GetShardFor(IGuild guild)

##### Parameters

Type | Name | Description
--- | --- | ---
IGuild | guild |

##### Returns

Type | Description
--- | ---
DiscordSocketClient |

| Improve this Doc View Source

#### GetShardIdFor(IGuild)

##### Declaration

    public int GetShardIdFor(IGuild guild)

##### Parameters

Type | Name | Description
--- | --- | ---
IGuild | guild |

##### Returns

Type | Description
--- | ---
System.Int32 |

| Improve this Doc View Source

#### GetUser(String, String)

##### Declaration

    public override SocketUser GetUser(string username, string discriminator)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | username |
System.String | discriminator |

##### Returns

Type | Description
--- | ---
SocketUser |

##### Overrides

BaseSocketClient.GetUser(String, String)
| Improve this Doc View Source

#### GetUser(UInt64)

##### Declaration

    public override SocketUser GetUser(ulong id)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |

##### Returns

Type | Description
--- | ---
SocketUser |

##### Overrides

BaseSocketClient.GetUser(UInt64)
| Improve this Doc View Source

#### GetVoiceRegion(String)

##### Declaration

    public override RestVoiceRegion GetVoiceRegion(string id)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | id |

##### Returns

Type | Description
--- | ---
RestVoiceRegion |

##### Overrides

BaseSocketClient.GetVoiceRegion(String)
| Improve this Doc View Source

#### SetActivityAsync(IActivity)

##### Declaration

    public override Task SetActivityAsync(IActivity activity)

##### Parameters

Type | Name | Description
--- | --- | ---
IActivity | activity |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

BaseSocketClient.SetActivityAsync(IActivity)
| Improve this Doc View Source

#### SetGameAsync(String, String, ActivityType)

##### Declaration

    public override Task SetGameAsync(string name, string streamUrl = null, ActivityType type = ActivityType.Playing)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name |
System.String | streamUrl |
ActivityType | type |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

BaseSocketClient.SetGameAsync(String, String, ActivityType)
| Improve this Doc View Source

#### SetStatusAsync(UserStatus)

##### Declaration

    public override Task SetStatusAsync(UserStatus status)

##### Parameters

Type | Name | Description
--- | --- | ---
UserStatus | status |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

BaseSocketClient.SetStatusAsync(UserStatus)
| Improve this Doc View Source

#### StartAsync()

##### Declaration

    public override Task StartAsync()

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

BaseSocketClient.StartAsync()
| Improve this Doc View Source

#### StopAsync()

##### Declaration

    public override Task StopAsync()

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

##### Overrides

BaseSocketClient.StopAsync()

### Events

| Improve this Doc View Source

#### ShardConnected

Fired when a shard is connected to the Discord gateway.

##### Declaration

    public event Func<DiscordSocketClient, Task> ShardConnected

##### Event Type

Type | Description
--- | ---
System.Func<DiscordSocketClient, System.Threading.Tasks.Task> |

| Improve this Doc View Source

#### ShardDisconnected

Fired when a shard is disconnected from the Discord gateway.

##### Declaration

    public event Func<Exception, DiscordSocketClient, Task> ShardDisconnected

##### Event Type

Type | Description
--- | ---
System.Func<System.Exception, DiscordSocketClient, System.Threading.Tasks.Task> |

| Improve this Doc View Source

#### ShardLatencyUpdated

Fired when a shard receives a heartbeat from the Discord gateway.

##### Declaration

    public event Func<int, int, DiscordSocketClient, Task> ShardLatencyUpdated

##### Event Type

Type | Description
--- | ---
System.Func<System.Int32, System.Int32, DiscordSocketClient, System.Threading.Tasks.Task> |

| Improve this Doc View Source

#### ShardReady

Fired when a guild data for a shard has finished downloading.

##### Declaration

    public event Func<DiscordSocketClient, Task> ShardReady

##### Event Type

Type | Description
--- | ---
System.Func<DiscordSocketClient, System.Threading.Tasks.Task> |

### Explicit Interface Implementations

| Improve this Doc View Source

#### IDiscordClient.CreateGuildAsync(String, IVoiceRegion, Stream, RequestOptions)

##### Declaration

    Task<IGuild> IDiscordClient.CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name |
IVoiceRegion | region |
System.IO.Stream | jpegIcon |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IGuild> |

| Improve this Doc View Source

#### IDiscordClient.GetApplicationInfoAsync(RequestOptions)

##### Declaration

    Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IApplication> |

| Improve this Doc View Source

#### IDiscordClient.GetChannelAsync(UInt64, CacheMode, RequestOptions)

##### Declaration

    Task<IChannel> IDiscordClient.GetChannelAsync(ulong id, CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IChannel> |

| Improve this Doc View Source

#### IDiscordClient.GetConnectionsAsync(RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IConnection>> IDiscordClient.GetConnectionsAsync(RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IConnection>> |

| Improve this Doc View Source

#### IDiscordClient.GetGuildAsync(UInt64, CacheMode, RequestOptions)

##### Declaration

    Task<IGuild> IDiscordClient.GetGuildAsync(ulong id, CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IGuild> |

| Improve this Doc View Source

#### IDiscordClient.GetGuildsAsync(CacheMode, RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IGuild>> IDiscordClient.GetGuildsAsync(CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IGuild>> |

| Improve this Doc View Source

#### IDiscordClient.GetInviteAsync(String, RequestOptions)

##### Declaration

    Task<IInvite> IDiscordClient.GetInviteAsync(string inviteId, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | inviteId |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IInvite> |

| Improve this Doc View Source

#### IDiscordClient.GetPrivateChannelsAsync(CacheMode, RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IPrivateChannel>> IDiscordClient.GetPrivateChannelsAsync(CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IPrivateChannel>> |

| Improve this Doc View Source

#### IDiscordClient.GetUserAsync(String, String, RequestOptions)

##### Declaration

    Task<IUser> IDiscordClient.GetUserAsync(string username, string discriminator, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | username |
System.String | discriminator |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IUser> |

| Improve this Doc View Source

#### IDiscordClient.GetUserAsync(UInt64, CacheMode, RequestOptions)

##### Declaration

    Task<IUser> IDiscordClient.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IUser> |

| Improve this Doc View Source

#### IDiscordClient.GetVoiceRegionAsync(String, RequestOptions)

##### Declaration

    Task<IVoiceRegion> IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | id |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IVoiceRegion> |

| Improve this Doc View Source

#### IDiscordClient.GetVoiceRegionsAsync(RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IVoiceRegion>> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IVoiceRegion>> |

### Implements

IDiscordClient
System.IDisposable