Releases: DiscordBM/DiscordBM
v1.6.0 - GatewayEventHandler functions can throw now
GatewayEventHandler
functions can throw too now, so you don't have to use an explicit do/catch.
Upon a thrown error, the GatewayEventHandler
will log the error while including the function name which threw the error.
The README has been updated to reflect this. As an example:
struct EventHandler: GatewayEventHandler {
let event: Gateway.Event
let client: any DiscordClient
func onMessageCreate(_ payload: Gateway.MessageCreate) async throws {
let response = try await client.createMessage(
channelId: payload.channel_id,
payload: .init(content: "Got a message: '\(payload.content)'")
)
let message = try response.decode()
}
}
The function can now be marked as throws
.
This previously needed a do/catch:
struct EventHandler: GatewayEventHandler {
let event: Gateway.Event
let client: any DiscordClient
func onMessageCreate(_ payload: Gateway.MessageCreate) async {
do {
let response = try await client.createMessage(
channelId: payload.channel_id,
payload: .init(content: "Got a message: '\(payload.content)'")
)
let message = try response.decode()
} catch {
print("We got an error! \(error)")
}
}
}
Full Changelog: v1.5.0...v1.6.0
v1.5.0 - Support monetization APIs + update with Discord changes
Update with Discord docs till October 28 2023
AuditLog.Entry.Action.memberRoleUpdate(integration_type: Integration.Kind)
now is(integration_type: Integration.Kind?)
. The type ofintegration_type
has been changed to beOptional
.- This is technically a breaking change, but considering that i deemed it low-impact, and a workaround would have been troublesome, i proceeded with the change.
- 3 new Gateway events:
entitlementCreate(Entitlement)
entitlementUpdate(Entitlement)
entitlementDelete(Entitlement)
- 5 new
DiscordClient
endpoints:updateOwnApplication(payload:)
listEntitlements(appId:userId:skuIds:before:after:limit:guildId:excludeEnded:)
createTestEntitlement(appId:payload:)
deleteTestEntitlement(appId:entitlementId:)
listSKUs(appId:)
DiscordCache
storesentitlements
now.Interaction
now contains theentitlements
.- You can create
premiumRequired()
as aInteractionResponse
. JSONErrorCode
has 2 new cases:anEntitlementHasAlreadyBeenGrantedForThisResource
invalidSKU
- Other minor changes. See full change log below for more info.
Full Changelog: v1.4.0...v1.5.0
v1.4.0 - Some Fixes, DiscordBM Swift 5.9 release delayed
DiscordBM release to move to requiring Swift 5.9 has been delayed as i need to workaround some macro issues first.
The release might be delayed up to when Swift 5.9.1 is released.
What's Changed
- Fix
bot.updatePresence(payload:)
by @codemeister64 in #57 - Rename/deprecate
startThreadInForumChannel
tostartThreadInForumOrMediaChannel
.- The response contains the returned message too now.
New Contributors
- @codemeister64 made their first contribution in #57
Full Changelog: v1.3.1...v1.4.0
v1.3.1 - Next release will require Swift 5.9+
Next release will require Swift 5.9+
Next release will make heavy use of macros to for a decent amount of better user experience as well as some performance boosts.
I have decided the library will not support Swift versions lower than 5.9 as soon as the macro is merged.
What's Changed
- Increase default backoff
maxAllowed
from 5 to 6 seconds.- I have a personal feeling from my experience that a 6s
maxAllowed
will be decently better in practice, as 5s is exactly the age of a bucket and a second more could help users not notice rate-limit problems even less.
- I have a personal feeling from my experience that a 6s
- Some other minor refinements such as more documentation.
Full Changelog: v1.3.0...v1.3.1
v1.3.0 - Updates, fixes and refinements
What's Changed
- Correct
DiscordClient.createFollowupMessage()
payload type fromPayloads.InteractionResponse
toPayloads.ExecuteWebhook
.- This change should technically only happen in major versions as it's not one of the exempt technically-breaking changes that DiscordBM reserves the right to make, but the function wasn't working before anyway so the change is justified.
Reaction
now contains much more info (f54a928).AuditLog.Action
'smemberKick
case now containsintegration_type: Integration.Kind
.AuditLog.Action
'smemberRoleUpdate
case containedintegration_type: Integration.Kind?
.integration_type
is no longer of anOptional
type.JSONErrorCode
has a newuserCannotUseBurstReactions
.Team
contains a newvar role: Role
. Role is an enum with cases declared asadmin
,developer
orreadOnly
.owner
While being a role in practice, it will still not appear as a case inRole
.
Full Changelog: v1.2.0...v1.3.0
v1.2.0
What's Changed
- Update with Discord docs till Aug 11 (discord/discord-api-docs@3bebe03)
Gateway.Activity
now accepts a newstate: String?
field.- This is only useful when
type
is set to.custom
. - Read more: https://discord.com/developers/docs/change-log#aug-8-2023
- This is only useful when
- Fix errors thrown by
SnowflakeInfo
. - Minor testing refinements.
Full Changelog: v1.1.2...v1.2.0
v1.1.2 - Fix permission-checking functions for public/private threads
Fix permission-checking functions for public/private threads
The below list of functions of Gateway.GuildCreate
are affected by this change:
memberHasPermissions(member:userId:channelId:permissions:)
memberHasGuildPermission(member:userId:permission:)
userHasPermissions(userId:channelId:permissions:)
userHasGuildPermission(userId:permission:)
Full Changelog: v1.1.1...v1.1.2
v1.1.1 - Better `DiscordColor`s matching Apple's HIG + Update with Discord docs
Fixing v1.1.0 release
Some commits were stuck on my computer.
What's Changed
- Better static func/vars for getting colors, according to Apple's HIG.
- This includes all the colors that Apple lists in https://developer.apple.com/design/human-interface-guidelines/color#iOS-iPadOS-system-colors:
red
,orange
,yellow
,green
,mint
.teal
,cyan
,blue
,indigo
,purple
,pink
,brown
.- Examples:
DiscordColor.green
/DiscordColor.indigo(scheme: .light)
/DiscordColor.pink(scheme: .dark)
.
- Also includes the gray colors which come in 6 different levels: https://developer.apple.com/design/human-interface-guidelines/color#iOS-iPadOS-system-gray-colors:
- Examples:
DiscordColor.gray
/DiscordColor.gray(scheme: .light)
/DiscordColor.gray(level: .level3, scheme: .dark)
.
- Examples:
- This includes all the colors that Apple lists in https://developer.apple.com/design/human-interface-guidelines/color#iOS-iPadOS-system-colors:
- Add 2 new API endpoints:
updateGuildOnboarding(guildId:reason:payload:)
andgetOwnApplication()
. - Updated an existing API endpoint:
listOwnGuilds(before:after:limit:)
->listOwnGuilds(before:after:limit:withCounts:)
. - Add a new CDN endpoint:
getCDNUserAvatarDecoration(userId:avatarDecoration:)
. - Fixed an issue decoding optional arrays of
_ToleratedDecode
enums. - New fields in
DiscordApplication
andPartialApplication
:guild: PartialGuild?
,approximate_guild_count: Int?
. - New field in
DiscordUser
,PartialUser
andMentionUser
:avatar_decoration: String?
. - New
AuditLog.Entry.Action
cases:creatorMonetizationRequestCreated
andcreatorMonetizationTermsAccepted
. - Better decode tolerance in
AuditLog.Entry.Action
. - New
DiscordChannel.Attachment.Flag
type containing 1 case:isRemix
. - New field in
DiscordChannel.Attachment
:flags: IntBitField<Flag>
. - New
JSONErrorCode
cases:cannotEnableOnboardingRequirementsAreNotMet
andcannotUpdateOnboardingWhileBelowRequirements
. - New
MessageReactionAdd
field:message_author_id: UserSnowflake?
. - New
Guild.Onboarding.Mode
type containing 2 cases:onboardingDefault
andonboardingAdvanced
. - New field in
Guild.Onboarding
:mode: Mode
. - New field in
Payloads.CreateGuildChannel
:default_forum_layout: DiscordChannel.ForumLayout?
. - New
Role.Flag
type containing 1 case:inPrompt
. - New field in
Role
:flags: IntBitField<Flag>
.
Full Changelog: v1.0.0...v1.1.1
v1.1.0 - Better `DiscordColor`s matching Apple's HIG + Update with Discord docs
What's Changed
- Better static func/vars for getting colors, according to Apple's HIG.
- This includes all the colors that Apple lists in https://developer.apple.com/design/human-interface-guidelines/color#iOS-iPadOS-system-colors:
red
,orange
,yellow
,green
,mint
.teal
,cyan
,blue
,indigo
,purple
,pink
,brown
.- Examples:
DiscordColor.green
/DiscordColor.indigo(scheme: .light)
/DiscordColor.pink(scheme: .dark)
.
- Also includes the gray colors which come in 6 different levels: https://developer.apple.com/design/human-interface-guidelines/color#iOS-iPadOS-system-gray-colors:
- Examples:
DiscordColor.gray
/DiscordColor.gray(scheme: .light)
/DiscordColor.gray(level: .level3, scheme: .dark)
.
- Examples:
- This includes all the colors that Apple lists in https://developer.apple.com/design/human-interface-guidelines/color#iOS-iPadOS-system-colors:
- Add 2 new API endpoints:
updateGuildOnboarding(guildId:reason:payload:)
andgetOwnApplication()
. - Updated an existing API endpoint:
listOwnGuilds(before:after:limit:)
->listOwnGuilds(before:after:limit:withCounts:)
. - Add a new CDN endpoint:
getCDNUserAvatarDecoration(userId:avatarDecoration:)
. - Fixed an issue decoding optional arrays of
_ToleratedDecode
enums. - New fields in
DiscordApplication
andPartialApplication
:guild: PartialGuild?
,approximate_guild_count: Int?
. - New field in
DiscordUser
,PartialUser
andMentionUser
:avatar_decoration: String?
. - New
AuditLog.Entry.Action
cases:creatorMonetizationRequestCreated
andcreatorMonetizationTermsAccepted
. - Better decode tolerance in
AuditLog.Entry.Action
. - New
DiscordChannel.Attachment.Flag
type containing 1 case:isRemix
. - New field in
DiscordChannel.Attachment
:flags: IntBitField<Flag>
. - New
JSONErrorCode
cases:cannotEnableOnboardingRequirementsAreNotMet
andcannotUpdateOnboardingWhileBelowRequirements
. - New
MessageReactionAdd
field:message_author_id: UserSnowflake?
. - New
Guild.Onboarding.Mode
type containing 2 cases:onboardingDefault
andonboardingAdvanced
. - New field in
Guild.Onboarding
:mode: Mode
. - New field in
Payloads.CreateGuildChannel
:default_forum_layout: DiscordChannel.ForumLayout?
. - New
Role.Flag
type containing 1 case:inPrompt
. - New field in
Role
:flags: IntBitField<Flag>
.
Full Changelog: v1.0.0...v1.1.0
v1.0.0 - First Release :)
Full Changelog: v1.0.0-rc.3...v1.0.0