Class DiscordShardedClient
A Discord client that shards automatically.
Inheritance
System.Object
DiscordShardedClient
Assembly: DisCatSharp.dll
Syntax
public sealed class DiscordShardedClient
Constructors
|
Improve this Doc
View Source
DiscordShardedClient(DiscordConfiguration)
Initializes a new auto-sharding Discord client.
Declaration
public DiscordShardedClient(DiscordConfiguration config)
Parameters
Properties
|
Improve this Doc
View Source
CurrentApplication
Gets the current application.
Declaration
public DiscordApplication CurrentApplication { get; }
Property Value
|
Improve this Doc
View Source
CurrentUser
Declaration
public DiscordUser CurrentUser { get; }
Property Value
|
Improve this Doc
View Source
GatewayInfo
Gets the gateway info for the client's session.
Declaration
public GatewayInfo GatewayInfo { get; }
Property Value
|
Improve this Doc
View Source
LibraryDeveloperTeam
Declaration
[Obsolete("Use GetLibraryDevelopmentTeamAsync")]
public DisCatSharpTeam LibraryDeveloperTeam { get; }
Property Value
|
Improve this Doc
View Source
Logger
Gets the logger for this client.
Declaration
public ILogger<BaseDiscordClient> Logger { get; }
Property Value
|
Improve this Doc
View Source
ShardClients
Declaration
public IReadOnlyDictionary<int, DiscordClient> ShardClients { get; }
Property Value
Type |
Description |
System.Collections.Generic.IReadOnlyDictionary<System.Int32, DiscordClient> |
|
|
Improve this Doc
View Source
VoiceRegions
Gets the list of available voice regions. Note that this property will not contain VIP voice regions.
Declaration
public IReadOnlyDictionary<string, DiscordVoiceRegion> VoiceRegions { get; }
Property Value
Type |
Description |
System.Collections.Generic.IReadOnlyDictionary<System.String, DiscordVoiceRegion> |
|
Methods
|
Improve this Doc
View Source
Finalize()
Declaration
protected void Finalize()
|
Improve this Doc
View Source
GetLibraryDevelopmentTeamAsync()
Declaration
public async Task<DisCatSharpTeam> GetLibraryDevelopmentTeamAsync()
Returns
|
Improve this Doc
View Source
GetShard(DiscordGuild)
Gets a shard from a guild.
If automatically sharding, this will use the GetShardId(UInt64, Int32) method.
Otherwise if manually sharding, it will instead iterate through each shard's guild caches.
Declaration
public DiscordClient GetShard(DiscordGuild guild)
Parameters
Type |
Name |
Description |
DiscordGuild |
guild |
The guild for the shard.
|
Returns
|
Improve this Doc
View Source
GetShard(UInt64)
Gets a shard from a guild id.
If automatically sharding, this will use the GetShardId(UInt64, Int32) method.
Otherwise if manually sharding, it will instead iterate through each shard's guild caches.
Declaration
public DiscordClient GetShard(ulong guildId)
Parameters
Type |
Name |
Description |
System.UInt64 |
guildId |
The guild ID for the shard.
|
Returns
|
Improve this Doc
View Source
StartAsync()
Initializes and connects all shards.
Declaration
public async Task StartAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Exceptions
Type |
Condition |
System.AggregateException |
|
System.InvalidOperationException |
|
|
Improve this Doc
View Source
StopAsync()
Disconnects and disposes all shards.
Declaration
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Exceptions
Type |
Condition |
System.InvalidOperationException |
|
|
Improve this Doc
View Source
UpdateStatusAsync(DiscordActivity, Nullable<UserStatus>, Nullable<DateTimeOffset>)
Updates the status on all shards.
Declaration
public async Task UpdateStatusAsync(DiscordActivity activity = null, UserStatus? userStatus = null, DateTimeOffset? idleSince = null)
Parameters
Type |
Name |
Description |
DiscordActivity |
activity |
The activity to set. Defaults to null.
|
System.Nullable<UserStatus> |
userStatus |
The optional status to set. Defaults to null.
|
System.Nullable<System.DateTimeOffset> |
idleSince |
Since when is the client performing the specified activity. Defaults to null.
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
Asynchronous operation.
|
Events
|
Improve this Doc
View Source
ApplicationCommandCreated
Fired when a new application command is registered.
Declaration
public event AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs> ApplicationCommandCreated
Event Type
|
Improve this Doc
View Source
ApplicationCommandDeleted
Fired when an application command is deleted.
Declaration
public event AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs> ApplicationCommandDeleted
Event Type
|
Improve this Doc
View Source
ApplicationCommandPermissionsUpdated
Fired when application command permissions gets updated.
Declaration
public event AsyncEventHandler<DiscordClient, ApplicationCommandPermissionsUpdateEventArgs> ApplicationCommandPermissionsUpdated
Event Type
|
Improve this Doc
View Source
ApplicationCommandUpdated
Fired when an application command is updated.
Declaration
public event AsyncEventHandler<DiscordClient, ApplicationCommandEventArgs> ApplicationCommandUpdated
Event Type
|
Improve this Doc
View Source
ChannelCreated
Fired when a new channel is created.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ChannelCreateEventArgs> ChannelCreated
Event Type
|
Improve this Doc
View Source
ChannelDeleted
Fired when a channel is deleted
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ChannelDeleteEventArgs> ChannelDeleted
Event Type
|
Improve this Doc
View Source
ChannelPinsUpdated
Fired whenever a channel's pinned message list is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ChannelPinsUpdateEventArgs> ChannelPinsUpdated
Event Type
|
Improve this Doc
View Source
ChannelUpdated
Fired when a channel is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ChannelUpdateEventArgs> ChannelUpdated
Event Type
|
Improve this Doc
View Source
ClientErrored
Fired whenever an error occurs within an event handler.
Declaration
public event AsyncEventHandler<DiscordClient, ClientErrorEventArgs> ClientErrored
Event Type
|
Improve this Doc
View Source
ComponentInteractionCreated
Fired when a component is invoked.
Declaration
public event AsyncEventHandler<DiscordClient, ComponentInteractionCreateEventArgs> ComponentInteractionCreated
Event Type
|
Improve this Doc
View Source
Fired when a user uses a context menu.
Declaration
public event AsyncEventHandler<DiscordClient, ContextMenuInteractionCreateEventArgs> ContextMenuInteractionCreated
Event Type
|
Improve this Doc
View Source
DmChannelDeleted
Fired when a dm channel is deleted
For this Event you need the DirectMessages intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, DmChannelDeleteEventArgs> DmChannelDeleted
Event Type
|
Improve this Doc
View Source
EmbeddedActivityUpdated
Fired when a embedded activity has been updated.
Declaration
public event AsyncEventHandler<DiscordClient, EmbeddedActivityUpdateEventArgs> EmbeddedActivityUpdated
Event Type
|
Improve this Doc
View Source
GuildApplicationCommandCountUpdated
Fired when a new application command is registered.
Declaration
public event AsyncEventHandler<DiscordClient, GuildApplicationCommandCountEventArgs> GuildApplicationCommandCountUpdated
Event Type
|
Improve this Doc
View Source
GuildAvailable
Fired when a guild is becoming available.
Declaration
public event AsyncEventHandler<DiscordClient, GuildCreateEventArgs> GuildAvailable
Event Type
|
Improve this Doc
View Source
GuildBanAdded
Fired when a guild ban gets added
For this Event you need the GuildBans intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildBanAddEventArgs> GuildBanAdded
Event Type
|
Improve this Doc
View Source
GuildBanRemoved
Fired when a guild ban gets removed
For this Event you need the GuildBans intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildBanRemoveEventArgs> GuildBanRemoved
Event Type
|
Improve this Doc
View Source
GuildCreated
Fired when the user joins a new guild.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildCreateEventArgs> GuildCreated
Event Type
Equivalent names
GuildJoined, JoinedGuild
|
Improve this Doc
View Source
GuildDeleted
Fired when the user leaves or is removed from a guild.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildDeleteEventArgs> GuildDeleted
Event Type
|
Improve this Doc
View Source
GuildDownloadCompleted
Fired when all guilds finish streaming from Discord.
Declaration
public event AsyncEventHandler<DiscordClient, GuildDownloadCompletedEventArgs> GuildDownloadCompleted
Event Type
|
Improve this Doc
View Source
GuildEmojisUpdated
Declaration
public event AsyncEventHandler<DiscordClient, GuildEmojisUpdateEventArgs> GuildEmojisUpdated
Event Type
|
Improve this Doc
View Source
GuildIntegrationCreated
Declaration
public event AsyncEventHandler<DiscordClient, GuildIntegrationCreateEventArgs> GuildIntegrationCreated
Event Type
|
Improve this Doc
View Source
GuildIntegrationDeleted
Declaration
public event AsyncEventHandler<DiscordClient, GuildIntegrationDeleteEventArgs> GuildIntegrationDeleted
Event Type
|
Improve this Doc
View Source
GuildIntegrationsUpdated
Fired when a guild integration is updated.
Declaration
public event AsyncEventHandler<DiscordClient, GuildIntegrationsUpdateEventArgs> GuildIntegrationsUpdated
Event Type
|
Improve this Doc
View Source
GuildIntegrationUpdated
Declaration
public event AsyncEventHandler<DiscordClient, GuildIntegrationUpdateEventArgs> GuildIntegrationUpdated
Event Type
|
Improve this Doc
View Source
GuildMemberAdded
Fired when a new user joins a guild.
For this Event you need the GuildMembers intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildMemberAddEventArgs> GuildMemberAdded
Event Type
|
Improve this Doc
View Source
GuildMemberRemoved
Fired when a user is removed from a guild (leave/kick/ban).
For this Event you need the GuildMembers intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildMemberRemoveEventArgs> GuildMemberRemoved
Event Type
|
Improve this Doc
View Source
GuildMembersChunked
Fired in response to Gateway Request Guild Members.
Declaration
public event AsyncEventHandler<DiscordClient, GuildMembersChunkEventArgs> GuildMembersChunked
Event Type
|
Improve this Doc
View Source
GuildMemberTimeoutAdded
Fired when a guild member timeout gets added.
For this Event you need the GuildBans intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildMemberTimeoutAddEventArgs> GuildMemberTimeoutAdded
Event Type
|
Improve this Doc
View Source
GuildMemberTimeoutChanged
Fired when a guild member timeout gets changed.
For this Event you need the GuildMembers intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildMemberTimeoutUpdateEventArgs> GuildMemberTimeoutChanged
Event Type
|
Improve this Doc
View Source
GuildMemberTimeoutRemoved
Fired when a guild member timeout gets removed.
For this Event you need the GuildMembers intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildMemberTimeoutRemoveEventArgs> GuildMemberTimeoutRemoved
Event Type
|
Improve this Doc
View Source
GuildMemberUpdated
Fired when a guild member is updated.
For this Event you need the GuildMembers intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildMemberUpdateEventArgs> GuildMemberUpdated
Event Type
|
Improve this Doc
View Source
GuildRoleCreated
Fired when a guild role is created.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildRoleCreateEventArgs> GuildRoleCreated
Event Type
|
Improve this Doc
View Source
GuildRoleDeleted
Fired when a guild role is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildRoleDeleteEventArgs> GuildRoleDeleted
Event Type
|
Improve this Doc
View Source
GuildRoleUpdated
Fired when a guild role is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildRoleUpdateEventArgs> GuildRoleUpdated
Event Type
|
Improve this Doc
View Source
GuildScheduledEventCreated
Declaration
public event AsyncEventHandler<DiscordClient, GuildScheduledEventCreateEventArgs> GuildScheduledEventCreated
Event Type
|
Improve this Doc
View Source
GuildScheduledEventDeleted
Declaration
public event AsyncEventHandler<DiscordClient, GuildScheduledEventDeleteEventArgs> GuildScheduledEventDeleted
Event Type
|
Improve this Doc
View Source
GuildScheduledEventUpdated
Declaration
public event AsyncEventHandler<DiscordClient, GuildScheduledEventUpdateEventArgs> GuildScheduledEventUpdated
Event Type
|
Improve this Doc
View Source
GuildScheduledEventUserAdded
Declaration
public event AsyncEventHandler<DiscordClient, GuildScheduledEventUserAddEventArgs> GuildScheduledEventUserAdded
Event Type
|
Improve this Doc
View Source
GuildScheduledEventUserRemoved
Declaration
public event AsyncEventHandler<DiscordClient, GuildScheduledEventUserRemoveEventArgs> GuildScheduledEventUserRemoved
Event Type
|
Improve this Doc
View Source
GuildStickersUpdated
Declaration
public event AsyncEventHandler<DiscordClient, GuildStickersUpdateEventArgs> GuildStickersUpdated
Event Type
|
Improve this Doc
View Source
GuildUnavailable
Fired when a guild becomes unavailable.
Declaration
public event AsyncEventHandler<DiscordClient, GuildDeleteEventArgs> GuildUnavailable
Event Type
|
Improve this Doc
View Source
GuildUpdated
Fired when a guild is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, GuildUpdateEventArgs> GuildUpdated
Event Type
|
Improve this Doc
View Source
Heartbeated
Fired on received heartbeat ACK.
Declaration
public event AsyncEventHandler<DiscordClient, HeartbeatEventArgs> Heartbeated
Event Type
|
Improve this Doc
View Source
InteractionCreated
Fired when an interaction is invoked.
Declaration
public event AsyncEventHandler<DiscordClient, InteractionCreateEventArgs> InteractionCreated
Event Type
|
Improve this Doc
View Source
InviteCreated
Fired when an invite is created.
For this Event you need the GuildInvites intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, InviteCreateEventArgs> InviteCreated
Event Type
|
Improve this Doc
View Source
InviteDeleted
Fired when an invite is deleted.
For this Event you need the GuildInvites intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, InviteDeleteEventArgs> InviteDeleted
Event Type
|
Improve this Doc
View Source
MessageCreated
Fired when a message is created.
For this Event you need the GuildMessages intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, MessageCreateEventArgs> MessageCreated
Event Type
|
Improve this Doc
View Source
MessageDeleted
Fired when a message is deleted.
For this Event you need the GuildMessages intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, MessageDeleteEventArgs> MessageDeleted
Event Type
|
Improve this Doc
View Source
MessageReactionAdded
Declaration
public event AsyncEventHandler<DiscordClient, MessageReactionAddEventArgs> MessageReactionAdded
Event Type
|
Improve this Doc
View Source
MessageReactionRemoved
Declaration
public event AsyncEventHandler<DiscordClient, MessageReactionRemoveEventArgs> MessageReactionRemoved
Event Type
|
Improve this Doc
View Source
MessageReactionRemovedEmoji
Fired when all reactions of a specific reaction are removed from a message.
For this Event you need the GuildMessageReactions intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, MessageReactionRemoveEmojiEventArgs> MessageReactionRemovedEmoji
Event Type
|
Improve this Doc
View Source
MessageReactionsCleared
Declaration
public event AsyncEventHandler<DiscordClient, MessageReactionsClearEventArgs> MessageReactionsCleared
Event Type
|
Improve this Doc
View Source
MessagesBulkDeleted
Fired when multiple messages are deleted at once.
For this Event you need the GuildMessages intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, MessageBulkDeleteEventArgs> MessagesBulkDeleted
Event Type
|
Improve this Doc
View Source
MessageUpdated
Fired when a message is updated.
For this Event you need the GuildMessages intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, MessageUpdateEventArgs> MessageUpdated
Event Type
|
Improve this Doc
View Source
PayloadReceived
Fired when a gateway payload is received.
Declaration
public event AsyncEventHandler<DiscordClient, PayloadReceivedEventArgs> PayloadReceived
Event Type
|
Improve this Doc
View Source
PresenceUpdated
Fired when a presence has been updated.
For this Event you need the GuildPresences intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, PresenceUpdateEventArgs> PresenceUpdated
Event Type
|
Improve this Doc
View Source
Ready
Fired when the client enters ready state.
Declaration
public event AsyncEventHandler<DiscordClient, ReadyEventArgs> Ready
Event Type
|
Improve this Doc
View Source
Resumed
Fired whenever a session is resumed.
Declaration
public event AsyncEventHandler<DiscordClient, ReadyEventArgs> Resumed
Event Type
|
Improve this Doc
View Source
SocketClosed
Fired whenever WebSocket connection is terminated.
Declaration
public event AsyncEventHandler<DiscordClient, SocketCloseEventArgs> SocketClosed
Event Type
|
Improve this Doc
View Source
SocketErrored
Fired whenever a WebSocket error occurs within the client.
Declaration
public event AsyncEventHandler<DiscordClient, SocketErrorEventArgs> SocketErrored
Event Type
|
Improve this Doc
View Source
SocketOpened
Fired whenever WebSocket connection is established.
Declaration
public event AsyncEventHandler<DiscordClient, SocketEventArgs> SocketOpened
Event Type
|
Improve this Doc
View Source
StageInstanceCreated
Fired when a Stage Instance is created.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, StageInstanceCreateEventArgs> StageInstanceCreated
Event Type
|
Improve this Doc
View Source
StageInstanceDeleted
Fired when a Stage Instance is deleted.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, StageInstanceDeleteEventArgs> StageInstanceDeleted
Event Type
|
Improve this Doc
View Source
StageInstanceUpdated
Fired when a Stage Instance is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, StageInstanceUpdateEventArgs> StageInstanceUpdated
Event Type
|
Improve this Doc
View Source
ThreadCreated
Fired when a thread is created.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ThreadCreateEventArgs> ThreadCreated
Event Type
|
Improve this Doc
View Source
ThreadDeleted
Fired when a thread is deleted.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ThreadDeleteEventArgs> ThreadDeleted
Event Type
|
Improve this Doc
View Source
ThreadListSynced
Fired when a thread member is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ThreadListSyncEventArgs> ThreadListSynced
Event Type
|
Improve this Doc
View Source
ThreadMembersUpdated
Declaration
public event AsyncEventHandler<DiscordClient, ThreadMembersUpdateEventArgs> ThreadMembersUpdated
Event Type
|
Improve this Doc
View Source
ThreadMemberUpdated
Fired when a thread member is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ThreadMemberUpdateEventArgs> ThreadMemberUpdated
Event Type
|
Improve this Doc
View Source
ThreadUpdated
Fired when a thread is updated.
For this Event you need the Guilds intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, ThreadUpdateEventArgs> ThreadUpdated
Event Type
|
Improve this Doc
View Source
TypingStarted
Fired when a user starts typing in a channel.
Declaration
public event AsyncEventHandler<DiscordClient, TypingStartEventArgs> TypingStarted
Event Type
|
Improve this Doc
View Source
UnknownEvent
Fired when an unknown event gets received.
Declaration
public event AsyncEventHandler<DiscordClient, UnknownEventArgs> UnknownEvent
Event Type
|
Improve this Doc
View Source
UserSettingsUpdated
Fired when the current user updates their settings.
For this Event you need the GuildPresences intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, UserSettingsUpdateEventArgs> UserSettingsUpdated
Event Type
|
Improve this Doc
View Source
UserUpdated
Fired when properties about the current user change.
For this Event you need the GuildPresences intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, UserUpdateEventArgs> UserUpdated
Event Type
|
Improve this Doc
View Source
VoiceServerUpdated
Fired when a guild's voice server is updated.
For this Event you need the GuildVoiceStates intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, VoiceServerUpdateEventArgs> VoiceServerUpdated
Event Type
|
Improve this Doc
View Source
VoiceStateUpdated
Fired when someone joins/leaves/moves voice channels.
For this Event you need the GuildVoiceStates intent specified in Intents
Declaration
public event AsyncEventHandler<DiscordClient, VoiceStateUpdateEventArgs> VoiceStateUpdated
Event Type
|
Improve this Doc
View Source
WebhooksUpdated
Fired whenever webhooks update.
Declaration
public event AsyncEventHandler<DiscordClient, WebhooksUpdateEventArgs> WebhooksUpdated
Event Type
|
Improve this Doc
View Source
Zombied
Fired on heartbeat attempt cancellation due to too many failed heartbeats.
Declaration
public event AsyncEventHandler<DiscordClient, ZombiedEventArgs> Zombied
Event Type
Extension Methods
Equivalent names
GuildJoined
JoinedGuild