Swiftpack.co - Swift Packages by DiscordBM

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Packages published by DiscordBM

DiscordBM/DiscordBM v1.10.0
A Multiplatform Swift Discord Library, Primarily For Making Bots
⭐️ 63
🕓 11 weeks ago
🔖 Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
1.10.1 - Use `HTTPClient.shared` as default + Simplify README
2 weeks ago
## What's Changed * Use `HTTPClient.shared` and `HTTPClient.shared.eventLoopGroup` as default `HTTPClient` and `EventLoopGroup` in https://github.com/DiscordBM/DiscordBM/pull/68 * Fix a bug when mixing `PartialUser` with `DiscordUser` which could result in removing `author` of a `DiscordUser`. **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.10.0...1.10.1
v1.10.0 - Introducing `UnstableEnum` macro - UPDATE RECOMMENDED
11 weeks ago
## What's Changed * `@UnstableEnum` macro for enums that will have more cases over time in https://github.com/DiscordBM/DiscordBM/pull/52 ## Discussion This version introduces a `UnstableEnum` macro: * The macro makes every raw-representable enum that it's assigned to more resilient. * All enums with this macro have a new case called `__undocumented(RawValue)`. * Adding enum cases is allowed based on `DiscordBM`'s policy mentioned in the README, so this is not considered a "Breaking Change" by `DiscordBM`. * If Discord introduces a new enum value (which is pretty common), the macro will save the undocumented value in the `__undocumented` case. * Usage of `__undocumented` is discouraged as it's not considered part of `DiscordBM`'s API and can cause code breakage. * If `DiscordBM` adds the proper enum case for an `__undocumented` value, codes that count on `__undocumented` will stop working after a `DiscordBM` update. Extra caution needs needs to be taken. * In normal Swift, an undocumented enum value will make the whole decoding process fail, which is catastrophic. * Imagine receiving a massive `GUILD_CREATE` event, but the event fails to decode only because one enum cannot be decoded, and your code stops working properly. * `DiscordBM` had some `Codable` hacks in place which mitigated the damage caused by this behavior, but now these decoding failures will be a thing of the past. * Updating to this version of `DiscordBM` is **HIGHLY RECOMMENDED** to make sure you don't face silent decoding failures which can cause bugs in your applications. This version drops support for Swift 5.7 and 5.8. This due to the macro usage which requires Swift 5.9. **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.9.1...v1.10.0
v1.9.1 - Minor fixes
13 weeks ago
## What's Changed * Repair an api-breakage by Discord, occasionally sending `Activity.application_id` of type `Int`. * Fix a build failure in WebSocket tests. **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.9.0...v1.9.1
v1.9.0
13 weeks ago
## What's Changed * Add 43 and 44 `Permission`s in https://github.com/DiscordBM/DiscordBM/pull/63 * `43` is `createGuildExpressions`. * `44` is `createEvents`. * Add `require` functions for `Interaction.Data` in https://github.com/DiscordBM/DiscordBM/pull/64 * `requireApplicationCommand()` * `requireMessageComponent()` * `requireModalSubmit()` **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.8.0...v1.9.0
v1.8.0 - Minor updates
17 weeks ago
## What's Changed * Add `applied_tags` to execute-webhook payload in https://github.com/DiscordBM/DiscordBM/pull/61 * Temporary fix for a decoding error (Would have not been a problem if i could merge [this PR](https://github.com/DiscordBM/DiscordBM/pull/52) :( ) **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.7.0...v1.8.0
v1.7.0 - `GatewayManager` use `events` instead of `makeEventsStream()`
24 weeks ago
## What's Changed * `GatewayManager` move to using `events` instead of `makeEventsStream()` Previously you would do: ```swift for await event in await bot.makeEventsStream() { /// Do something with `event` } ``` Now you do: ```swift for await event in await bot.events { /// Do something with `event` } ``` For most users, this is only a change to nicer names. But in fact, the `AsyncSequence` of `bot.events` is of type `DiscordAsyncSequence` which enables DiscordBM to change the underlying implementation to something more-optimized in the future, if needs be. ## Decoding Fixes Some decoding failures have been resolved. For example Discord silently changed `Guild.Member.joined_at` to be nullable, which resulted in some decode failures. DiscordBM will now set `Guild.Member.joined_at` to `Date.distantFuture` if no value is provided by Discord. This prevents DiscordBM breaking its public API due to Discord changes, by marking `Guild.Member.joined_at` as `Optional`. Also some `AuditLog.Entry` decode failures have been resolved. **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.6.0...v1.7.0
v1.6.0 - GatewayEventHandler functions can throw now
25 weeks ago
`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](https://github.com/DiscordBM/DiscordBM) has been updated to reflect this. As an example: ```swift 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: ```swift 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**: https://github.com/DiscordBM/DiscordBM/compare/v1.5.0...v1.6.0
v1.5.0 - Support monetization APIs + update with Discord changes
25 weeks ago
## Update with Discord docs till October 28 2023 * `AuditLog.Entry.Action.memberRoleUpdate(integration_type: Integration.Kind)` now is `(integration_type: Integration.Kind?)`. The type of `integration_type` has been changed to be `Optional`. * 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` stores `entitlements` now. * `Interaction` now contains the `entitlements`. * You can create `premiumRequired()` as a `InteractionResponse`. * `JSONErrorCode` has 2 new cases: * `anEntitlementHasAlreadyBeenGrantedForThisResource` * `invalidSKU` * Other minor changes. See full change log below for more info. **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.4.0...v1.5.0
v1.4.0 - Some Fixes, DiscordBM Swift 5.9 release delayed
30 weeks ago
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 https://github.com/DiscordBM/DiscordBM/pull/57 * Rename/deprecate `startThreadInForumChannel` to `startThreadInForumOrMediaChannel`. * The response contains the returned message too now. ## New Contributors * @codemeister64 made their first contribution in https://github.com/DiscordBM/DiscordBM/pull/57 **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.3.1...v1.4.0
v1.3.1 - Next release will require Swift 5.9+
31 weeks ago
### 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. * Some other minor refinements such as more documentation. **Full Changelog**: https://github.com/DiscordBM/DiscordBM/compare/v1.3.0...v1.3.1
iOS macOS watchOS tvOS linux macOS iOS

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics