v5.0.0
Welcome to Discore v5!
Discore v5 includes a decent amount of changes. Please review the 4.x to 5.x migration guide and the changelog below.
Breaking Changes
- Discore now targets .NET 6.0.
- Discord entities (such as
DiscordMessage) no longer keep a reference to aDiscordHttpClientinternally and therefore no longer have methods for modifying the entity.- All removed methods were just shortcuts for
DiscordHttpClientcalls and can be migrated by just using aDiscordHttpClientinstead (ex.DiscordMessage.Edit()->DiscordHttpClient.EditMessage(DiscordMessage)).
- All removed methods were just shortcuts for
- Caching breaking changes:
DiscordShardCachehas been replaced with the newDiscore.Caching.DiscordMemoryCache.Shard.Cachewas removed in favor of making caching optional for Gateway connections. To get built-in caching behavior back, instantiate the newDiscordMemoryCachewith yourShard. The newDiscordMemoryCacheobject has a nearly identical interface to the oldDiscordShardCache.- DM channels are no longer cached since the Gateway no longer sends 'Channel Create' events for DMs as of v8.
IDiscordGatewaybreaking changes:- Events have been renamed to be more consistent. All new event names follow the pattern
OnEventName(e.g.OnMessageCreatedwas renamed toOnMessageCreate). - Events now emit unique event args per event instead of some events sharing arg types (arg class names now follow the pattern
EventNameEventArgs). OnMessageUpdatednow emits aDiscordPartialMessageinstead of a normalDiscordMessage.OnGuildAvailableandOnGuildUnavailablewere merged intoOnGuildCreateandOnGuildDelete. To see whether the guild availability status changed, use the newBecameAvailableandUnavailableproperties in the event args.OnDMChannel*events were removed (bots no longer receive events for DM channels as of Gateway v8).OnChannel*events now emit aDiscordChannelinstead of aDiscordGuildChannel(matches the actual Gateway spec).UpdateStatusAsyncwas renamed toUpdatePresenceAsync.
- Events have been renamed to be more consistent. All new event names follow the pattern
- Voice breaking changes:
- Voice connections are now decoupled from
Shardinstances. - Removed
DiscordVoiceConnection.Shard. - Removed
ShardVoiceManager(use the newDiscordVoiceConnectionconstructors instead). - Removed
VoiceConnectionEventArgs.Shard. - Removed
VoiceConnectionInvalidationReason.BotRemovedFromGuild(this case is now just a normal invalidation). - Removed
Shard.Voice.
- Voice connections are now decoupled from
Shard.StartAsyncnow requires either aGatewayIntentorShardStartConfigargument.- Renamed
DiscordGametoDiscordActivity(to match Gateway v8 changes). - Renamed
DiscordGameTypetoDiscordActivityType(to match Gateway v8 changes). - Removed
DiscordUserPresence.Game(useActivities.FirstOrDefault()instead). - Renamed
StatusOptionstoPresenceOptions.PresenceOptionsnow takes a list of activities instead of a singleGame.
- Renamed
GameOptionstoActivityOptions. DiscordVoiceConnection.SetSpeakingAsyncwill now throw anInvalidOperationExceptionif called before being fully connected.DiscordVoiceConnection.ClearVoiceBufferwill now throw anInvalidOperationExceptionif called before being fully connected.DiscordVoiceConnection.ConnectAsyncno longer checks if the application is allowed to join the voice channel. If the application is not allowed to join the connection will still fail, but it will be attempted.- To get this functionality back, please use the new
DiscordPermissionHelper.CanJoinVoiceChannelhelper function.
- To get this functionality back, please use the new
DiscordHttpRateLimitException.Limitis now nullable.DiscordHttpRateLimitException.Resetis now nullable.DiscordHttpRateLimitException.ResetHighPrecisionis now nullable.ShardStartConfig.GatewayLargeThresholdnow defaults to the Gateway's default of 50 (down from 250).DiscordHttpErrorCode.TooManyReactionsrenamed toMaximumReactionsReached.DiscordHttpRateLimitException.RetryAfteris now adoubleand includes millisecond precision.- Guild embeds are replaced with guild widgets (API v8 change):
- Removed
DiscordGuild.IsEmbedEnabledandEmbedChannelId(useIsWidgetEnabledandWidgetChannelIdinstead). - Renamed
DiscordGuildEmbedtoDiscordGuildWidgetSettings. - Renamed
DiscordHttpErrorCode.EmbedDisabledtoWidgetDisabled. - Renamed
ModifyGuildEmbedOptionstoModifyGuildWidgetOptions. - Renamed
DiscordHttpClient.GetGuildEmbedtoGetGuildWidget. - Renamed
DiscordHttpClient.ModifyGuildEmbedtoModifyGuildWidget.
- Removed
- Removed deprecated
ShardFailureReason.IOError DiscordHttpClient.BeginGuildPrunenow returns null ifcomputePruneCountis true.- Renamed
Create/EditMessageOptions.EmbedtoEmbedsto support multiple embeds per message. DiscordHttpClient.Create/EditMessagefile attachment overloads have been removed. Instead, please use the newAttachmentsproperty ofCreate/EditMessageOptions.- Removed
DiscordHttpClient.UseSingleHttpClient(it's no longer needed). - Removed deprecated
DiscordHttpClient.GetUserDMs. Shard.OnReconnectedis now fired at the end of reconnection (as probably expected), rather than the start. This is still guaranteed to be fired beforeOnReady.Create/ModifyGuildOptions.VerificationLevelis now typeGuildVerificationLevel.Create/ModifyGuildOptions.DefaultMessageNotificationsis now typeGuildNotificationOption.- Removed deprecated/removed
DiscordVoiceRegionproperties (SampleHostname,SamplePort,IsVIPOnly). DiscordEmbed.Coloris now typeDiscordColor.- Renamed
DiscordUser.HasTwoFactorAuthtoMfaEnabled. DiscordIntegration.ExpireBehavioris typeIntegrationExpireBehavior.DiscordInvitechanges:- Renamed
TargetUserTypetoTargetType. Channelis now nullable.Inviteris now a property ofDiscordInviteinstead ofDiscordInviteMetadata(should only break reflection).
- Renamed
- Removed
DiscordInviteMetadata.IsRevoked. - Renamed
DiscordInviteChannel.ChannelIdtoId. - Renamed
DiscordInviteGuild.GuildIdtoId. - Renamed
DiscordInviteTargetUserTypetoDiscordInviteTargetType. - Removed
ShardVoiceManager.GetUsersInVoiceChannel(please useDiscordMemoryCache.GetUsersInVoiceChannelinstead). - Removed
DiscordGuild.RegionId(deprecated). - Removed
DiscordPermissionException(was no longer thrown from any normal APIs). - Removed
DiscordPermissionHelper.AssertPermission(applications should make their own assert helpers usingHasPermission).
Additions
- Added support for creating and editing messages with multiple embeds and/or multiple attachments.
- Added support for Gateway intents.
- Intents can be specified using
ShardStartConfig.IntentsorShard.StartAsync(GatewayIntent).
- Intents can be specified using
- Added
Create/EditMessageOptions.Flags. - Added
DiscordAttachment.Description. - Added
DiscordAttachment.ContentType. - Added
DiscordAttachment.Ephemeral. - Added
Shard.OnDisconnected. - Added
ShardFailureReason.InvalidIntents. - Added
ShardFailureReason.DisallowedIntents. - Added
DiscordHttpApiException.Errors. - Added
DiscordHttpRateLimitException.Bucket. - Added
DiscordVoiceConnection.SetSpeakingAsyncoverload to take newSpeakingFlagparameter for more specific speaking states. - Added
DiscordVoiceConnectionconstructors for creating a connection from a shard or a voice bridge. - Added a
DiscordVoiceConnection.ConnectAsyncparameter for changing the connection timeout period. - Added
IDiscordGateway.OnVoiceServerUpdateevent. - Added
IDiscordGateway.UpdateVoiceStateAsync. - Added
MemberSpeakingEventArgs.SpeakingFlag. - Added
DiscordMessage.GuildId. - Added
IDiscordGuildMemberbase interface. - Added more flexible
DiscordPermissionHelper.HasPermissionoverload. - Added
DiscordPermissionHelper.CanJoinVoiceChannel. - Added
DiscordPermissionHelper.PermissionsToString. - Added
VoiceConnectionInvalidationReason.DllNotFound.
Changes
- Discore now fully annotates nullable reference types!
- Discore now supports Discord API/Gateway v10.
- Discore now supports voice Gateway v4.
DiscordGuildVoiceChannelnow implementsITextChannelto support guild voice text chat.Snowflakenow implementsIEquatable<Snowflake>.DiscordCdnUrlnow implementsIEquatable<DiscordCdnUrl>.- Removed dependency on
Newtonsoft.Json.
Bug Fixes
- Fixed race condition that occurred when the application is kicked from a voice channel.
- Fixed
DiscordWebSocketExceptionnot containing anInnerExceptionwhen one was provided. - Miscellaneous internal bug fixes found thanks to nullable reference type annotations.
NuGet
Version 5.0.0 can be downloaded via NuGet here.