2023-04-27 Updates

We've published minor versions of a number of crates. This release is composed of bugfixes, new features, performance improvements, documentation improvements, and dependency updates.

Bugfixes

Discord's Clyde AI bot has a unique avatar hash. Unlike other hashes that are hex based, Clyde's avatar hash is simply "clyde". We now handle deserialization of Clyde's avatar in our ImageHash optimization.

Application command interaction options of type String are no longer trimmed of leading zeroes.

The UpdateCurrentMember request now correctly removes the current member's nickname if passed None.

The gateway queue's DayLimiter now properly calculates when the session resets.

The UpdateGuildSticker request now uses the specified audit log reason; prior, it was accidentally ignoring the reason.

Dependency Updates

The allowed version range of simd-json was broadened to >=0.4, <0.10 in twilight-gateway and twilight-http.

Documentation Improvements

Standby now has an example of how to timeout futures and streams.

The Event::IntegrationDelete and Event::IntegrationUpdate variants' documentation was inversed, and has now been corrected.

Feature Additions

The AutoModerationTriggerMetadata struct now supports the mention_total_limit and regex_patterns fields.

The guild Permissions bitflag now supports the VIEW_CREATOR_MONETIZATION_ANALYTICS and USE_SOUNDBOARD variants and renames MANAGE_EMOJIS_AND_STICKERS to MANAGE_GUILD_EXPRESSIONS.

The Interaction struct now supports the channel field.

Performance Improvements

The gateway's CommandRatelimiter performance has been improved by over 98%, with common calls being reduced from around 4 microseconds to around 57 nanoseconds. This is something that can be used by users, and is also used by shards when sending commands, making common operations just a bit more speedy. Impressive!

Avatars, banners, icons, and other assets are received as hashes, which we have ImageHash for as a performance improvement in storage. Instead of storing hashes as heap-allocated strings, we store them as 16 bytes on the stack. The performance of the deserialization and parsing of hashes is now 38% faster.

Caching users received in InteractionCreate events is now a bit faster in some situations due to keying into a HashMap to check for the existence of a user instead of iterating over the HashMap.