Releases: Francessco121/Discore
v5.0.1
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.
v4.5.0
This release adds support for some small newer Discord API features, such as getting custom user statuses and creating reply messages.
New Message Create/Edit Options (#85)
- Added
AllowedMentionsproperty toCreateMessageOptionsandEditMessageOptionsfor avoiding accidental mentions in messages. - Added
CreateMessageOptions.MessageReferencefor creating reply messages. - Added new
DiscordMessageFlags:SourceMessageDeletedUrgentHasThreadEphemeralLoading
New DiscordGame (Activity) Properties (#92)
Information such as custom user statuses and rich presence details can now be read.
- Added new
DiscordGameproperties:CreatedAtTimestampsApplicationIdDetailsStateEmojiPartyAssetsSecretsInstanceFlagsButtons
- Added new
DiscordGameTypes:ListeningWatchingCustomCompeting
New GuildPrune Parameters (#84)
- Added
includeRolesparameter toGetGuildPruneCountandBeginGuildPrunefor pruning users with specific roles. - Added
computePruneCountparameter toBeginGuildPruneto allow reduced execution time for large guilds. - The
daysparameter ofGetGuildPruneCountandBeginGuildPruneis now nullable (when null Discord will use their own default).
New CDN URL Builders (#95)
- Added new static
DiscordCdnUrlbuilders and theirDiscordCdnUrlTypes:ApplicationCoverApplicationAssetAchievementIconStickerPackBannerTeamIconStickerRoleIcon
NuGet
Version 4.5.0 can be downloaded via NuGet here.
v4.4.1
This patch addresses issues with stopping Shards. Calling Shard.StopAsync will now behave as expected. (#82)
Fixes
DiscordClientWebSocketno longer erroneously sends a close acknowledgment when receiving a remote close after starting a close itself locally.GatewaySocketno longer erroneously attempts to reconnect when receiving a remote close after starting a close itself locally.
NuGet
Version 4.4.1 can be downloaded via NuGet here.
v4.4.0
Update For Discord API Domain Migration (#79)
On November 7, 2020 Discord will be dropping support for the discordapp.com domain in favor of the new discord.com domain. Notably however, the CDN will not be changing domains. This update includes internal changes to address this migration.
API calls through Discore versions below 4.4.0 will cease to work on November 7, 2020.
CDN URLs produced by Discore will continue to work.
User Presence Additions (#75)
- Added
DiscordUserPresence.Activities. - Added
DiscordUserPresence.ClientStatus.
NuGet
Version 4.4.0 can be downloaded via NuGet here.
v4.3.1
This patch addresses the overlooked implementation for news and store channels as well as other miscellaneous bug fixes.
Fixes
- Added missing
DiscordGuildNewsChannelandDiscordGuildStoreChannelclasses. - Added missing
DiscordHttpClientmethods:ModifyNewsChannelandModifyStoreChannel. - Added missing
DiscordShardCachemethods:GetGuildNewsChannelandGetGuildStoreChannel. - Fixed
IDiscordGateway.OnGuildChannelCreatednot firing for category, news, and store channels. - Fixed
IDiscordGateway.OnGuildChannelUpdatednot firing for news and store channels. - Fixed
IDiscordGateway.OnGuildChannelRemovednot firing for news and store channels. - Fixed
DiscordShardCachenever containing news and store channels. - Fixed
DiscordChannel.IsGuildChannelreturningfalsefor news and store channels. - Fixed
DiscordGuildMember.GuildIdbeing an empty snowflake when the member was retrieved from aDiscordHttpClient.
NuGet
Version 4.3.1 can be downloaded via NuGet here.
v4.3.0
Additions
New Channel Types (#64)
- Added
DiscordChannelType.GuildNews - Added
DiscordChannelType.GuildStore
New Invite Properties (#58)
- Added
DiscordInvite.TargetUser - Added
DiscordInvite.TargetUserType - Added
DiscordInvite.ApproximatePresenceCount - Added
DiscordInvite.ApproximateMemberCount - Added new enum
DiscordInviteTargetUserType
New GetInvite Parameter
DiscordHttpClient.GetInvite now has a new optional parameter withCounts, which when specified as true will return a DiscordInvite with both ApproximatePresenceCount and ApproximateMemberCount filled out.
New Guild Properties (#62)
- Added
DiscordGuild.MaxPresences - Added
DiscordGuild.MaxMembers - Added
DiscordGuild.VanityUrlCode - Added
DiscordGuild.Description - Added
DiscordGuild.Banner - Added
DiscordGuild.PremiumTier - Added
DiscordGuild.PremiumSubscriptionCount - Added new enum
GuildPremiumTier - Added
DiscordCdnUrl.ForGuildBanner - Added
DiscordCdnUrlType.GuildBanner
Constants For Guild Features (#63)
- A new static class is available named
DiscordGuildFeaturewhich contains constants for each guild feature such as"ANIMATED_ICON". - Added
DiscordGuild.HasFeatureas an alternative to searchingDiscordGuild.Features
New Message Metadata (#65)
- Added
DiscordMessage.Member - Added
DiscordMessage.MentionedChannels(note: this is only available for crossposted messages) - Added
DiscordMessage.Activity - Added
DiscordMessage.Application - Added
DiscordMessage.MessageReference - Added
DiscordMessage.Flags - Added new enum
DiscordMessageActivityType - Added new enum
DiscordMessageFlags - Added new class
DiscordChannelMention - Added new class
DiscordMessageActivity - Added new class
DiscordMessageApplication - Added new class
DiscordMessageMember - Added new class
DiscordMessageReference
New Message Types (#66)
- Added
DiscordMessageType.UserPremiumGuildSubscription - Added
DiscordMessageType.UserPremiumGuildSubscriptionTier1 - Added
DiscordMessageType.UserPremiumGuildSubscriptionTier2 - Added
DiscordMessageType.UserPremiumGuildSubscriptionTier3 - Added
DiscordMessageType.ChannelFollowAdd
Guild Member Permission Extensions (#67)
All of the existing methods in DiscordPermissionHelper are now available as extension methods off of DiscordGuildMember.
- Added ext
DiscordGuildMember.HasPermission - Added ext
DiscordGuildMember.AssertPermission
Changes
Deprecated API For Listing Open DM Channels
Bots have not been able to use API features related to listing open DM channels for a while now.
- Deprecated
DiscordHttpClient.GetUserDMs
Deprecated OAuth2-only User Properties
Bots never had access to some user properties that have been in Discore for a while, these are now deprecated. If Discore ever adds full support for OAuth2 applications, these will come back. For now, since these properties will always be null, they will be marked as obsolete as a warning that they shouldn't be relied upon currently.
- Deprecated
DiscordUser.HasTwoFactorAuth - Deprecated
DiscordUser.IsVerified - Deprecated
DiscordUser.Email
Rate Limit Improvements (#55, #57)
- Discore now correctly handles rate-limit buckets, this will further reduce the chance 429 encounters
- All API requests now take advantage of the new millisecond precision for rate-limit timestamps
Miscellaneous
- Discore will now log a warning if a Gateway connection ends up with different shard information than what was specified during the connection. This should never (and probably will not) ever happen, but now will properly be logged if it does.
Updated Dependencies
- ConcurrentHashSet: 1.0.2 -> 1.1.0
- Newtonsoft.Json: 10.0.3 -> 12.0.2
- Nito.AsyncEx.Coordination: 1.0.2 -> 5.0.0
- System.ValueTuple: 4.4.0 -> 4.5.0
NuGet
Version 4.3.0 can be downloaded via NuGet here.
v4.2.1
v4.2.0
Changes
- Discore no longer creates/uses the
discore-local-storage.jsonfile. This file can be removed from any projects using Discore (#51). ShardFailureReason.IOErrorhas been deprecated as it can no longer occur (#51).- Internal fixes/tweaks to improve stability (#52).
NuGet
Version 4.2.0 can be downloaded via NuGet here.
v4.1.3
Bug Fixes
- Tweak to bring voice UDP connections more inline with API documentation fixes (see discord/discord-api-docs#588) (#50).
- Minor log message fixes for voice connections.
NuGet
Version 4.1.3 can be downloaded via NuGet here.