🗂️Changelog
All changes for the Discord.swift library.
Last updated
All changes for the Discord.swift library.
Last updated
New Features
Implementation of authenticated attachment URL parameters
Added property Message.Attachment.expires
Added property Message.Attachment.issued
Added property Message.Attachment.signature
Added property ThreadChannel.ownerId
Added parameter clearCache
to Bot.disconnect()
. This allows you to preserve the cache if the manual disconnect is only temporary instead of a forced clear.
Bug Fixes
Fixed an issue introduced in 0.1.2-beta where messages could not be removed from the cache after they have been expired if using Bot.run()
Fixed an issue where more than one identify payload would be sent at some point during uptime which would result in an error.
Updated
If the value passed to parameter timeout
in UI.init()
happened to be below 0, its default value is now set to 0 instead of the UI.init()
default value. This means the UI.onTimeout
closure is immediately executed, unlike before where it would wait 120 seconds.
New Features
Released on Oct. 8, 2023
Added parameter platform
to EventListener.onPresenceUpdate()
Implementation of premium app subscriptions
Added struct Application.Sku
Added enum Application.SkuType
Added enum Application.SkuFlag
Added struct Application.Entitlement
Added enum Application.EntitlementType
Added property Interaction.entitlements
Added method Interaction.respondWithPremiumRequired()
Added enum case InteractionCallbackType.premiumRequired
Added method Bot.createTestEntitlement()
Added method Bot.entitlements()
Added method Bot.skus()
Added method EventListener.onEntitlementCreate()
Added method EventListener.onEntitlementUpdate()
Added method EventListener.onEntitlementDelete()
Bug Fixes
Fixed an issue where the bot would disconnect randomly after an arbitrary amount of time. With this fix, an additional layer of gateway disconnect protection has been added. The bot is now aware of if it did/did not receive a heartbeat ACK in response to a sent heartbeat, and will reconnect if a heartbeat ACK was not sent by Discord.
Fixed an issue where if a Discord server outage occurred, upon the guild being available again, there was a possibility that its cached members in property Guild.members
could be removed/replaced.
Fixed an issue where it was possible to have multiple heartbeats being sent simultaneously after a new gateway session was started due to an unlikely invalidated session.
Updated
(Breaking Change) Removed EventListener.onDisconnect()
(Breaking Change) Parameter activities
in EventListener.onPresenceUpdate()
is longer an optional type.
Released on Sept. 29, 2023
New Features
Added property Message.customEmojis
Added property Markdown.mentionServerGuide
Added method EventListener.onDisconnect()
Added method Bot.run()
Added method Bot.close()
Added struct SelectMenu.DefaultValue
Added property SelectMenu.defaultValues
Added parameter defaultValues
to SelectMenu.init()
Bug Fixes
Fixed an issue where if Bot.disconnect()
was used and the app didn't immediately exit/terminate, CPU and memory usage would peak indefinitely which would render your app unusable. With this fix, users can now freely connect and disconnect without issue (see updated).
Fixed an issue where an additional typing indicator would still be displayed even after Messageable.triggerTyping(while:)
was finished executing.
Updated
(Breaking Change) With bug fix #1, the way you connect to Discord has changed. With this update, Bot.connect()
no longer throws
, is not an async
method, and does not block to maintain the connection. Method Bot.disconnect()
also no longer releases that block, they simply do as their name suggests, connects and disconnects. To connect and block to maintain the connection, you now use Bot.run()
and to release the block, use Bot.close()
(Breaking Change) Property Bot.users
is now of type Set<User>
(Breaking Change) The following have been renamed:
EventListener.init(name:isEnabled)
→ EventListener.init(name:enabled)
SelectMenu.MenuType.channels
→ SelectMenu.MenuType.channel
SelectMenu.disabled
→ SelectMenu.isDisabled
SelectMenu.Option.default
→ SelectMenu.Option.isDefault
Guild.chunked
→ Guild.isChunked
Asset.animated
→ Asset.isAnimated
AutoModerationRule.enabled
→AutoModerationRule.isEnabled
ForumChannel.Tag.moderated
→ ForumChannel.Tag.isModerated
VoiceChannel.State.guildDeafened
→ VoiceChannel.State.isGuildDeafened
VoiceChannel.State.guildMuted
→ VoiceChannel.State.isGuildMuted
VoiceChannel.State.selfDeafened
→ VoiceChannel.State.isSelfDeafened
VoiceChannel.State.selfMuted
→ VoiceChannel.State.isSelfMuted
VoiceChannel.State.streaming
→ VoiceChannel.State.isStreaming
VoiceChannel.State.cameraEnabled
→ VoiceChannel.State.isCameraEnabled
VoiceChannel.State.suppressed
→ VoiceChannel.State.isSuppressed
ThreadChannel.archived
→ ThreadChannel.isArchived
ThreadChannel.locked
→ ThreadChannel.isLocked
Button.disabled
→ Button.isDisabled
TextInput.required
→ TextInput.isRequired
Embed.Field.inline
→ Embed.Field.isInline
Emoji.requireColons
→ Emoji.requiresColons
Emoji.managed
→ Emoji.isManaged
Emoji.animated
→ Emoji.isAnimated
Emoji.available
→ Emoji.isAvailable
PartialEmoji.animated
→ PartialEmoji.isAnimated
ApplicationCommandOption.required
→ ApplicationCommandOption.isRequired
ApplicationCommandInteractionDataOption.focused
→ ApplicationCommandInteractionDataOption.isFocused
Invite.temporary
→ Invite.isTemporary
Message.Attachment.ephemeral
→ Message.Attachment.isEphemeral
Message.Attachment.spoiler
→ Message.Attachment.isSpoiler
ApplicationCommandPermissions.allowed
→ ApplicationCommandPermissions.isAllowed
Role.managed
→ Role.isManaged
Role.mentionable
→ Role.isMentionable
GuildSticker.available
→ GuildSticker.isAvailable
ClientUser.mfaEnabled
→ ClientUser.isMfaEnabled
Released on Sept. 24, 2023
New Features
Added method Member.getRole()
Added method Guild.getMember(name:)
Added method Bot.once()
Added property VoiceChannel.State.userId
Added property VoiceChannel.State.guildId
Added property VoiceChannel.State.member
Added property User.status
Added property User.activities
Added property User.platform
Added property User.isOnMobile
Added property User.Activity.flags
Added enum User.ActivityFlag
Added struct User.Platform
. This contains information such as which platform the user is currently on as well as their status.
Bug Fixes
Fixed an issue where if a user left a voice channel and they were not in the cache, an error would occur.
Fixed an issue where property VoiceChannel.members
would not return the proper amount of members.
Fixed an issue where an error could occur due to an unhandled .goingAway
WebSocket event.
Updated
(Breaking Change) Property CacheManager.channels
has been removed. This caused an underlying issue where it was possible for various Message
properties/methods to error because of a missing value. This only affected users who had it disabled.
(Breaking Change) Properties Guild.mentionChannelAndRoles
and Guild.mentionBrowseChannels
have been moved to Markdown
(Breaking Change) Removed struct User.PresenceActivity
. Along with this change, its properties were converted into enum case associated values in enum User.ActivityType
. This makes it a little easier to update your bot presence.
Before: bot.updatePresence(status: .dnd, activity: .init(User.ActivityType.game, name: "in the clouds"))
After: bot.updatePresence(status: .dnd, activity: .game("in the clouds"))
Method Bot.updatePresence()
no longer throws
Released on Sept. 15, 2023
New Features
Added Linux support .
Added throw
ing of gateway errors.
Added method Guild.chunkMembers()
Added property Guild.chunked
Added property Guild.memberCount
Added property ClientUser.bot
Added property User.displayName
Added property Message.nonce
Added property Message.isMentioned
Added parameter user
to EventListener.onReady()
Added method EventListener.onRawGuildMemberUpdate()
Added enum case Message.Edit.flags
Added struct CacheManager
. This controls your bots caching capabilities. Completely disable User
, Member
, GuildChannel
, or Message
caching. Depending on your use case, this can reduce your bots memory footprint especially at scale. You can use the cache manager via parameter cacheManager
in Bot.init()
Bug Fixes
Fixed an issue where property Member.premiumSince
was always nil
Fixed a pre-release issue where thread related events weren't being dispatched.
Fixed a spelling error that prevented sharding from being enabled.
(Breaking Change) The following has been renamed:
Class Discord
→ Bot
Enum case GatewayError.invalidSeq
→ GatewayError.invalidSequence
(Breaking Change) Bot.token
is no longer a property and can now be accessed via method Bot.token()
(Breaking Change) Bot.updatePresence()
is no longer an async
method.
(Breaking Change) Parameter maxMessagesCache
has been removed from Bot.init()
(replaced with parameter cacheManager
).
(Breaking Change) Removed MediaChannel
. This was added a tad bit too early, we'll wait for further documentation. Along with this change, Guild.mediaChannels
, and ChannelType.media
have been removed.
(Breaking Change) Removed parameter ignoreDms
from Bot.init()
. This was removed because intents provide more granular control of DMs. Even with it removed, you can still ignore DMs by excluding Intents.dmMessages
, in addition to the other DM related intents.
Initial startup Guild Member Chunking has been removed. Prior to this update, if you had Intents.guildPresences
enabled, all members for every guild would be cached. This would unnecessarily inflate memory usage. With it being removed, you can still opt-in to caching every member of a guild via Guild.chunkMembers()
The exclusion of the guildPresences
intent has been added to Intents.default
The associated value for enum case Member.Edit.move
is now VoiceChannel
The EventListener.onReady()
event is now dispatched when all guilds have been cached. Unlike before where it would dispatch when all guilds and all its members were cached.
With Linux support, Vapor and WebSocketKit have been added as dependencies.
Released on Aug. 27, 2023
New Features
Added method Messageable.deleteAllMessages()
Added parameter style
to Markdown.escape()
Added parameter suppressEmbed
to Markdown.maskedLink()
Added property Role.isDefault
Added property Role.isPremiumSubscriber
Added property Role.unicodeEmoji
Added enum case Role.Edit.unicodeEmoji
Added method Role.clone()
Added property Application.Team.Member.role
Added property Application.roleConnectionsVerificationUrl
Added the following application flag enum cases (see updated #2):
Application.Flag.applicationAutoModerationRuleCreateBadge
Application.Flag.applicationCommandBadge
Added the following system channel flag enum cases (see updated #2):
SystemChannelFlag.suppressRoleSubscriptionPurchaseNotifications
SystemChannelFlag.suppressRoleSubscriptionPurchaseNotificationReplies
Added enum Application.Team.MemberRole
Updated
(Breaking Change) Parameter emoji
in Guild.createRole()
has been renamed to unicodeEmoji
(Breaking Change) The following have been renamed to provide more consistency throughout the library:
Enum Application.ApplicationFlag
→ Application.Flag
Enum Message.Flags
→ Message.Flag
Enum SystemChannelFlags
→ SystemChannelFlag
Enum User.PublicUserFlags
→ User.Flag
. Along with this change, case User.Flag.none
has been removed.
Property User.publicUserFlags
→ User.flags
and is no longer an optional type.
(Breaking Change) The following guild feature enum cases have been removed:
Guild.Feature.monetizationEnabled
Guild.Feature.privateThreads
Guild.Feature.textInVoiceEnabled
Released on Aug.24, 2023
New Features
Added property GuildChannel.permissionsSynced
Bug Fixes
Fixed an issue where an error would occur if a voice channel was created.
Updated
Webhook
is now a struct
instead of a class
PermissionOverwrites
now conforms to protocol Equatable
Released on Aug. 16, 2023
New Features
Added method Discord.getEmoji()
Added method User.mentionedIn()
Added method Member.mentionedIn()
Added property Member.dmChannel
Added property Guild.mentionChannelAndRoles
Added property Guild.mentionBrowseChannels
Updated
(Breaking Change) Property Member.isPending
is no longer an optional type.
Released on Aug. 9, 2023
New Features
Added property Color.teal
Added method Guild.getStageInstance()
Added method Guild.getVoiceState()
Added case Guild.Edit.safetyAlertsChannel
Added case Guild.Edit.community
Added case Guild.Edit.discoverable
Added case Guild.Edit.invitesDisabled
Added case Guild.Edit.raidAlertsDisabled
Added case Message.Flags.suppressNotifications
Added case Message.Flags.isVoiceMessage
Added parameter silent
to Messageable.send()
Added class MediaChannel
. Discord stated that this new channel type is still in beta, so although it's implemented, specific features might not function as intended until final release. With the addition of the class, the following has also been added:
Property Guild.mediaChannels
Case ChannelType.guildMedia
Bug Fixes
Fixed an issue where an error would occur if someone left a voice channel.
Fixed an issue where property ForumChannel.lastMessageId
was not being updated when a new thread was created.
Fixed an issue where various errors would occur if a guild was edited. This relates to the following properties:
Guild.icon
Guild.splash
Guild.discoverySplash
Guild.banner
Updated
Property User.description
now displays only the users name instead of their name and discriminator if they have been migrated to the new Discord naming system.
Property User.defaultAvatarUrl
now distinguishes between migrated and non-migrated users.
Property GuildChannel.mention
now checks whether the channel type is a category. If so, the hashtag is no longer included because categories cannot be properly mentioned.
Released on Jul. 31, 2023
New Features
Added method Interaction.respondWithAutocomplete()
. This change enables the ability to dynamically generate responses compared to the previous method where only static responses could be provided via suggestions
(see updated).
Added parameter spoiler
to File.init()
Added property File.spoiler
Added property Message.Attachment.spoiler
Updated
(Breaking Change) ApplicationCommandOption
Removed parameter suggestions
from the .init()
Removed property ApplicationCommandOption.suggestions
Released on Jul. 10, 2023
New Features
Added the ability to reset a Role
color and icon back to its default state.
Updated
(Breaking Change) Parameter with
in method Discord.createDm()
now only accepts User
instead of Snowflake
.
Released on Jun. 28, 2023
New Features
Added property PermissionOverwrites.type
.
Structures Asset
and Color
now conform to protocol Hashable
.
Bug Fixes
Fixed an issue where PermissionOverwrites.init()
could error if the Member
that was passed to the for
parameter was not found in the internal cache.
Updated
Property Message.Reference.failIfNotExists
was changed to a variable instead of a constant.
(Breaking Change) PermissionOverwrites
Property PermissionOverwrites.target
was renamed to id
and is now of type Snowflake
.
Parameter id
have been added to PermissionOverwrites.init()
. The for
parameter is now of type OverwriteType
.
PermissionOverwrites.init()
is no longer failable. With this change, the following no longer returns optional values:
GuildChannel.overwrites
CategoryChannel.overwrites
TextChannel.overwrites
ForumChannel.overwrites
VoiceChannel.overwrites
ThreadChannel.overwrites
Released on Jun. 23, 2023
Added property Discord.channels
.
Added property Discord.voiceStates
.
Added property Member.mutualGuilds
.
Added protocol Downloadable
. All conforming objects now have a .download()
method. This provides an easy way to convert URLs (such as images) into aFile
. With this addition, the following objects now conform to that protocol:
Asset
Message.Attachment
(see updated)
Embed.Image
Embed.Thumbnail
Emoji
Fixed method Discord.getMember()
sometimes returning the wrong member.
Fixed event listener onGuildMemberRemove()
sometimes dispatching the wrong member.
(Breaking Change) Added parameter in
to method Discord.getMember()
.
(Breaking Change) Method Message.Attachment.toFile()
was renamed to Message.Attachment.download()
.
Released on Jun. 19, 2023
New Features
Added method Asset.download()
.
Added parameter ignoreDms
to Discord.init()
.
Added the following cases for Permissions
:
Permissions.useExternalSoundboard
Permissions.sendVoiceMessages
Updated
The following have been enabled in property Permissions.default
:
Permissions.useVoiceActivityDetection
Permissions.useSoundboard
Permissions.useExternalSoundboard
Permissions.sendVoiceMessages
Documentation is now available.
Released on June 13, 2023.
New Features
Added function channelLink()
.
Added function messageLink()
.
Added property Guild.categories
.
Added property GuildChannel.guild
.
Added property GuildChannel.guildId
.
Added property CategoryChannel.channels
.
Added property categoryId
to all channel types that conform to protocol GuildChannel
.
Added init Color(hex:)
.
Bug Fixes
Fixed an issue where channels that have a category
property would return nil
even when they belonged to a category.
Fixed an issue where audit logs were not being filtered by their actionType
even when an action type was set.
Fixed an issue where the following methods would error if a message had a reaction:
Messageable.history()
Messageable.requestMessage()
Released on June 7, 2023.
New Features
Added property ApplicationCommand.mention
.
Added property Message.mention
(see updated).
Added struct Markdown
. This contains all methods related to markdowns. The following has been added:
Markdown.blockQuote()
Markdown.bold()
Markdown.codeBlock()
Markdown.customEmoji()
Markdown.escape()
Markdown.header()
Markdown.inlineCode()
Markdown.list()
Markdown.maskedLink()
Markdown.mentionChannel()
Markdown.mentionRole()
Markdown.mentionSlashCommand()
Markdown.mentionUser()
Markdown.spoiler()
Markdown.suppressLinkEmbed()
Markdown.strikethrough()
Markdown.underline()
Bug Fixes
Fixed property Emoji.url
returning a .png URL even when the emoji was animated (.gif).
Updated
Property GuildChannel.jumpUrl
and Message.jumpUrl
now returns a suppressed link. With the Discord app update, messages that contain channel/message links are displayed as mentions. This changes it so that .jumpUrl
and .mention
have separate use cases.
With the addition of Markdown
, the following has been changed:
(Breaking Change) Function clean()
was renamed to escape
and is now under Markdown.escape()
. This also comes with a new parameter named :ignoreUrls
.
(Breaking Change) Function formatTimestamp()
was renamed to timestamp
and is now under Markdown.timestamp()
.
(Breaking Change) Enum TimestampStyle
is now under Markdown.TimestampStyle
.
Released on June 1, 2023.
New Features
Added method Discord.waitUntilReady()
.
Added method File.download()
.
Bug Fixes
Fixed event listener onReady()
not being dispatched when certain intents were missing.
Fixed the possibility that VoiceChannel.State
(Guild.voiceStates
) wouldn't' be fully updated.
Fixed property Guild.discoverySplash
returning nil
even if a discovery splash was present.
Fixed property Guild.splash
not being updated.
Fixed method ScheduledEvent.users()
error when called.
Updated
(Breaking Change) Method Guild.bans()
parameters before
and after
are now of type Date
.
(Breaking Change) Method Guild.bans()
return type is now Guild.AsyncBans
.
(Breaking Change) Method ScheduledEvent.users()
parameters before
and after
are now of type Date
.
(Breaking Change) Method ScheduledEvent.users()
return type is now ScheduledEvent.AsyncUsers
.
Various documentation improvements. Added documentation that was missing and corrected typos.
Released on May 27, 2023.
New Features
Added function getVariable()
.
Added function oauth2Url()
.
Added method Array.chunked()
.
Added property Guild.safetyAlertsChannelId
.
Added property Discord.emojis
.
Added case Guild.Feature.raidAlertsDisabled
.
Added enum OAuth2Scopes
(see updated).
Bug Fixes
Fixed Embed.clear()
not removing the timestamp.
Fixed PartialInvite.inviter
error when missing inviter.
Updated
Function clean()
now escapes bullet points and headers.
AutoModerationRule
(Breaking Change) Renamed AutoModerationRule.TriggerData
to Metadata
.
(Breaking Change) Renamed AutoModerationRule.Edit.triggers
to metadata
.
Added AutoModerationRule.metadata
. This now houses data such as keywordFilter
, presets
, etc.
Added AutoModerationRule.Metadata.mentionRaidProtectionEnabled
.
Added AutoModerationRule.Metadata
documentation.
(Breaking Change) Removed AutoModerationRule.keywordFilter
.
(Breaking Change) Removed AutoModerationRule.presets
.
(Breaking Change) Removed parameter mentionTotalLimit
from AutoModerationRule.Metadata
.
(Breaking Change) Parameter triggerData
renamed to metadata
in method Guild.createAutoModerationRule()
.
With the addition of OAuth2Scopes
, the following has been updated:
(Breaking Change) Property Application.InstallParams.scopes
is now of type Set<OAuth2Scopes>
.
(Breaking Change) Property Guild.Integration.scopes
is now of type Set<OAuth2Scopes>
.