Skip to content

v5.0.0

Compare
Choose a tag to compare
@Francessco121 Francessco121 released this 31 Jan 04:19
· 2 commits to master since this release
43fdd89

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 a DiscordHttpClient internally and therefore no longer have methods for modifying the entity.
    • All removed methods were just shortcuts for DiscordHttpClient calls and can be migrated by just using a DiscordHttpClient instead (ex. DiscordMessage.Edit() -> DiscordHttpClient.EditMessage(DiscordMessage)).
  • Caching breaking changes:
    • DiscordShardCache has been replaced with the new Discore.Caching.DiscordMemoryCache.
    • Shard.Cache was removed in favor of making caching optional for Gateway connections. To get built-in caching behavior back, instantiate the new DiscordMemoryCache with your Shard. The new DiscordMemoryCache object has a nearly identical interface to the old DiscordShardCache.
    • DM channels are no longer cached since the Gateway no longer sends 'Channel Create' events for DMs as of v8.
  • IDiscordGateway breaking changes:
    • Events have been renamed to be more consistent. All new event names follow the pattern OnEventName (e.g. OnMessageCreated was renamed to OnMessageCreate).
    • Events now emit unique event args per event instead of some events sharing arg types (arg class names now follow the pattern EventNameEventArgs).
    • OnMessageUpdated now emits a DiscordPartialMessage instead of a normal DiscordMessage.
    • OnGuildAvailable and OnGuildUnavailable were merged into OnGuildCreate and OnGuildDelete. To see whether the guild availability status changed, use the new BecameAvailable and Unavailable properties in the event args.
    • OnDMChannel* events were removed (bots no longer receive events for DM channels as of Gateway v8).
    • OnChannel* events now emit a DiscordChannel instead of a DiscordGuildChannel (matches the actual Gateway spec).
    • UpdateStatusAsync was renamed to UpdatePresenceAsync.
  • Voice breaking changes:
    • Voice connections are now decoupled from Shard instances.
    • Removed DiscordVoiceConnection.Shard.
    • Removed ShardVoiceManager (use the new DiscordVoiceConnection constructors instead).
    • Removed VoiceConnectionEventArgs.Shard.
    • Removed VoiceConnectionInvalidationReason.BotRemovedFromGuild (this case is now just a normal invalidation).
    • Removed Shard.Voice.
  • Shard.StartAsync now requires either a GatewayIntent or ShardStartConfig argument.
  • Renamed DiscordGame to DiscordActivity (to match Gateway v8 changes).
  • Renamed DiscordGameType to DiscordActivityType (to match Gateway v8 changes).
  • Removed DiscordUserPresence.Game (use Activities.FirstOrDefault() instead).
  • Renamed StatusOptions to PresenceOptions.
    • PresenceOptions now takes a list of activities instead of a single Game.
  • Renamed GameOptions to ActivityOptions.
  • DiscordVoiceConnection.SetSpeakingAsync will now throw an InvalidOperationException if called before being fully connected.
  • DiscordVoiceConnection.ClearVoiceBuffer will now throw an InvalidOperationException if called before being fully connected.
  • DiscordVoiceConnection.ConnectAsync no 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.CanJoinVoiceChannel helper function.
  • DiscordHttpRateLimitException.Limit is now nullable.
  • DiscordHttpRateLimitException.Reset is now nullable.
  • DiscordHttpRateLimitException.ResetHighPrecision is now nullable.
  • ShardStartConfig.GatewayLargeThreshold now defaults to the Gateway's default of 50 (down from 250).
  • DiscordHttpErrorCode.TooManyReactions renamed to MaximumReactionsReached.
  • DiscordHttpRateLimitException.RetryAfter is now a double and includes millisecond precision.
  • Guild embeds are replaced with guild widgets (API v8 change):
    • Removed DiscordGuild.IsEmbedEnabled and EmbedChannelId (use IsWidgetEnabled and WidgetChannelId instead).
    • Renamed DiscordGuildEmbed to DiscordGuildWidgetSettings.
    • Renamed DiscordHttpErrorCode.EmbedDisabled to WidgetDisabled.
    • Renamed ModifyGuildEmbedOptions to ModifyGuildWidgetOptions.
    • Renamed DiscordHttpClient.GetGuildEmbed to GetGuildWidget.
    • Renamed DiscordHttpClient.ModifyGuildEmbed to ModifyGuildWidget.
  • Removed deprecated ShardFailureReason.IOError
  • DiscordHttpClient.BeginGuildPrune now returns null if computePruneCount is true.
  • Renamed Create/EditMessageOptions.Embed to Embeds to support multiple embeds per message.
  • DiscordHttpClient.Create/EditMessage file attachment overloads have been removed. Instead, please use the new Attachments property of Create/EditMessageOptions.
  • Removed DiscordHttpClient.UseSingleHttpClient (it's no longer needed).
  • Removed deprecated DiscordHttpClient.GetUserDMs.
  • Shard.OnReconnected is now fired at the end of reconnection (as probably expected), rather than the start. This is still guaranteed to be fired before OnReady.
  • Create/ModifyGuildOptions.VerificationLevel is now type GuildVerificationLevel.
  • Create/ModifyGuildOptions.DefaultMessageNotifications is now type GuildNotificationOption.
  • Removed deprecated/removed DiscordVoiceRegion properties (SampleHostname, SamplePort, IsVIPOnly).
  • DiscordEmbed.Color is now type DiscordColor.
  • Renamed DiscordUser.HasTwoFactorAuth to MfaEnabled.
  • DiscordIntegration.ExpireBehavior is type IntegrationExpireBehavior.
  • DiscordInvite changes:
    • Renamed TargetUserType to TargetType.
    • Channel is now nullable.
    • Inviter is now a property of DiscordInvite instead of DiscordInviteMetadata (should only break reflection).
  • Removed DiscordInviteMetadata.IsRevoked.
  • Renamed DiscordInviteChannel.ChannelId to Id.
  • Renamed DiscordInviteGuild.GuildId to Id.
  • Renamed DiscordInviteTargetUserType to DiscordInviteTargetType.
  • Removed ShardVoiceManager.GetUsersInVoiceChannel (please use DiscordMemoryCache.GetUsersInVoiceChannel instead).
  • Removed DiscordGuild.RegionId (deprecated).
  • Removed DiscordPermissionException (was no longer thrown from any normal APIs).
  • Removed DiscordPermissionHelper.AssertPermission (applications should make their own assert helpers using HasPermission).

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.Intents or Shard.StartAsync(GatewayIntent).
  • 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.SetSpeakingAsync overload to take new SpeakingFlag parameter for more specific speaking states.
  • Added DiscordVoiceConnection constructors for creating a connection from a shard or a voice bridge.
  • Added a DiscordVoiceConnection.ConnectAsync parameter for changing the connection timeout period.
  • Added IDiscordGateway.OnVoiceServerUpdate event.
  • Added IDiscordGateway.UpdateVoiceStateAsync.
  • Added MemberSpeakingEventArgs.SpeakingFlag.
  • Added DiscordMessage.GuildId.
  • Added IDiscordGuildMember base interface.
  • Added more flexible DiscordPermissionHelper.HasPermission overload.
  • 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.
  • DiscordGuildVoiceChannel now implements ITextChannel to support guild voice text chat.
  • Snowflake now implements IEquatable<Snowflake>.
  • DiscordCdnUrl now implements IEquatable<DiscordCdnUrl>.
  • Removed dependency on Newtonsoft.Json.

Bug Fixes

  • Fixed race condition that occurred when the application is kicked from a voice channel.
  • Fixed DiscordWebSocketException not containing an InnerException when 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.