Serenity Rs Serenity Versions Save

A Rust library for the Discord API.

v0.12.1

1 month ago

Thanks to the following for their contributions:

Notable changes

In this release, the standard framework has been deprecated (#2733).

As Discord continues to endorse and evolve application commands (/... commands, user commands, message commands, etc.), the standard framework becomes increasingly outdated. Bots are also steadily losing (and already have lost) access to contents of messages, making it difficult to build a prefix-only bot. Unless you plan on restricting your bot to only accept commands in DMs, allowing its presence in only fewer than 100 guilds, or presenting a reasonable justification to Discord for permission to continue using message contents, you should migrate to application commands. We recommend poise, which supports writing both prefix and application commands with a #[command] macro like the standard framework.

Why not just update the framework?

Poise already exists and is better than the standard framework. Efforts should be directed at improving poise instead. To support application commands would require an overhaul of the standard framework, as they are special (for instance, Discord parses arguments on behalf of the bot and passes them as structured data, whereas for prefix commands, the bot must parse by itself).

Smaller, but still notable changes

  • (#2621) Add a temporary cache for messages.
  • (#2649) Deprecate RoleId::to_role_cached - Use Guild::roles instead.
  • (#2726) Pack bitflags - Reduces alignments of bitflags! types, resulting in a smaller memory footprint.
  • (#2696) Support attachments in forum posts.
  • (#2560) Add support for monetization apis.
  • (#2648) Deprecate inefficient emoji helpers - use the emoji methods on guildid/guild instead.

v0.12.0

4 months ago

This release turned out to be one of serenity's largest ever, with well over 300 PRs in total! It contains quite a few major breaking changes to the API. Therefore, the changelog for this release also serves as a migration guide for users upgrading from the 0.11 series.

Thanks to the following for their contributions:

Builders

The closure-based API for constructing requests using the builder pattern has been ripped out and replaced. In place of closures, users must now pass in builder types directly. For example, in serenity 0.11, code like the following was very common:

let channel = guild
    .create_channel(&http, |c| c.name("my-test-channel").kind(ChannelType::Text))
    .await?;

Now, users instead write the following code:

let builder = CreateChannel::new("my-test-channel").kind(ChannelType::Text);
let channel = guild.create_channel(&http, builder).await?;

Or, inline like so:

let channel = guild
    .create_channel(&http, CreateChannel::new("my-test-channel").kind(ChannelType::Text))
    .await?;

Note that in this particular example, the channel name is now a mandatory field that must be passed in when constructing the builder. Mutating the builder with subsequent calls to CreateChannel::name will change the underlying value. Additionally, all methods on builders now take mut self and return Self, instead of taking and returning &mut self/&mut Self. This allows for explicit construction as in the second example above. Also, builders no longer wrap a pub HashMap<&'static str, T>; the hashmap has been flattened into concrete private fields.

Some benefits to this new approach to builders are:

  1. Because every closure has a type unique to it, each call to a method taking a closure would be monomorphized separately, resulting in binary bloat. This is no longer the case.
  2. Builders can be constructed once and then cloned and re-used multiple times.
  3. Enforcement of field requirements (as dictated by the Discord API docs) provides compile-time request validation.

Attachments

  • The AttachmentType enum has been replaced with a CreateAttachment builder struct. This struct has the file, path, and url constructors that eagerly evaluate the data passed to them - CreateAttachment simply stores the resulting raw data. This is in contrast to AttachmentType which lazily carried filepaths/urls with it, and had data and filename methods for resolving them. Additionally, the CreateAttachment::to_base64 method can be used to manually encode an attachment if needed.
  • A new EditAttachments builder struct has been added for use with the attachments method on the EditMessage, EditWebhookMessage, and EditInteractionResponse builders. This new builder provides finer control when editing a message's existing attachments or uploading additional ones. Also, the following methods have been renamed to more accurately reflect their behavior:
serenity v0.11 serenity v0.12
EditMessage::attachment EditMessage::new_attachment
EditMessage::add_existing_attachment EditMessage::keep_existing_attachment
EditWebhookMessage::clear_existing_attachments EditWebhookMessage::clear_attachments
EditInteractionResponse::clear_existing_attachments EditInteractionResponse::clear_attachments

Collectors

Collectors have been redesigned and simplified at no cost to expressibility. There is now a generic collector::collect function which takes a closure as argument, letting you filter events as they stream in.

  • The specific collectors (ComponentInteractionCollector, ModalInteractionCollector, MessageCollector, and ReactionCollector) are simply convenience structs that wrap this underlying function.
  • EventCollector is now deprecated, as its use usually involved anti-patterns around fallibility. However, its functionality can still be replicated using collector::collect. See example 10 for more details.
  • The RelatedId and RelatedIdsForEventType types have been removed as they were only used by EventCollector. Methods for retrieving them from events have also been removed; if users wish to extract "related" ids from an event, they should do so directly from the event's fields. The removed methods are the following:
    • Event::user_id
    • Event::guild_id
    • Event::channel_id
    • Event::message_id
    • EventType::related_ids

Commands

In an effort to shorten long names and make import paths less unwieldy, Serenity now uses command instead of application_command in all places, except for the Permissions::USE_APPLICATION_COMMANDS constant. This includes methods on the Http, GuildId, Guild, PartialGuild, and Command types, as well as a few other miscellaneous places:

serenity v0.11 serenity v0.12
Http::*_{global,guild}_application_command* Http::*_{global,guild}_command*
{GuildId,Guild,PartialGuild}::*_application_command* {GuildId,Guild,PartialGuild}::*_command*
Command::*_global_application_command* Command::*_global_command*
Interaction::application_command Interaction::command
EventHandler::application_command_permissions_update EventHandler::command_permissions_update
Route::ApplicationCommand* Route::Command*
Permissions::use_application_commands Permissions::use_commands

Additionally, the following command types have been renamed:

serenity v0.11 serenity v0.12
CreateApplicationCommand CreateCommand
CreateApplicationCommandOption CreateCommandOption
CreateApplicationCommandPermissionData CreateCommandPermission
CreateApplicationCommandPermissionsData EditCommandPermissions
CommandPermission CommandPermissions
CommandPermissionData CommandPermission

Furthermore, the methods on CreateCommandPermission, such as new, kind, etc. have been replaced with constructors for each type of permission, e.g. role, user, channel, etc., to avoid a possible mismatch between kind and the id that gets passed in.

Finally, the {GuildId,Guild,PartialGuild}::create_command_permission method has been renamed to edit_command_permission to more accurately reflect its behavior.

Cache

  • Cache methods now return a CacheRef type that wraps a reference into the cache. Other methods that returned a map, now return a wrapper type around a reference to the map, with a limited API to prevent accidental deadlocks. This all helps reduce the number of clones when querying the cache. Those wishing to replicate the old behavior can simply call .clone() on the return type to obtain the wrapped data.
  • CacheSettings has new fields time_to_live, cache_guilds, cache_channels, and cache_users, allowing cache configuration on systems with memory requirements; whereas previously, memory-constrained systems were forced to disable caching altogether.
  • Caching for PrivateChannels (aka DM channels) has been removed, as they are never sent across the gateway by Discord. Therefore, the Cache::{private_channel, private_channels} methods have been removed, and Cache::guild_channel has been renamed to just Cache::channel. Additionally, some uses of the Channel enum in return types have been replaced with either GuildChannel or PrivateChannel as seen fit.

IDs

All *Id types have had their internal representations made private. Therefore, the API has changed as follows:

serenity v0.11 serenity v0.12
ExampleId(12345) ExampleId::new(12345)
example_id.as_u64() example_id.get()

Note that all *Id types now implement Into<u64> and Into<i64>. Additionally, attempting to instantiate an id with a value of 0 will panic.

Also, the implementations of FromStr for the UserId, RoleId, and ChannelId types now expect an integer rather than a mention string. The following table shows the new expected input strings:

serenity v0.11 serenity v0.12
ChannelId <#81384788765712384> 81384788765712384
RoleId <@&136107769680887808> 136107769680887808
UserId <@114941315417899012> or <@!114941315417899012> 114941315417899012

Users wishing to parse mentions should either parse into a Mention object, or use the utils::{parse_user_mention, parse_role_mention, parse_channel_mention} methods.

Interactions

The various interaction types have been renamed as follows:

serenity v0.11 serenity v0.12
ApplicationCommandInteraction CommandInteraction
MessageComponentInteraction ComponentInteraction
ModalSubmitInteraction ModalInteraction

Method names on interaction types have been shortened in the following way:

serenity v0.11 serenity v0.12
create_interaction_response create_response
create_followup_message create_followup
delete_original_interaction_response delete_response
delete_followup_message delete_followup
edit_original_interaction_response edit_response
edit_followup_message edit_followup
get_interaction_response get_response
get_followup_message get_followup
  • AutocompleteInteraction has been merged into CommandInteraction, along with its corresponding methods.
  • The kind field has been removed from each of the interaction structs.
  • A quick_modal method has been added to CommandInteraction and ComponentInteraction. See the docs for more details.

Framework

The standard framework is now configurable at runtime, as the configure method now takes self by reference. In line with the builder changes, the Configuration and BucketBuilder builders are no longer closure-based and must be passed in directly. Also, the Framework trait has been reworked to accomodate more use cases than just text commands:

  • The dispatch method now takes a FullEvent as argument instead of just a Message. This enum contains all the data that is passed to the EventHandler.
  • An optional init method has been added, that allows for more complex framework initialization, which can include executing HTTP requests, or accessing cache or shard data.

As a result, the trait now accomodates alternative frameworks more easily, such as poise.

Gateway

  • Renamed WsStream to WsClient.
  • The ShardManagerMonitor and ShardManagerMessage types have been removed. Their functionality has been replicated via methods directly on ShardManager. Any fields with type Sender<ShardManagerMessage>, as well as the Client::shard_manager field, have had their types changed to Arc<ShardManager>. The new methods on ShardManager are the following:
    • return_with_value
    • shutdown_finished
    • restart_shard
    • update_shard_latency_and_stage
  • The ShardClientMessage and InterMessage enums were deemed redundant wrappers around ShardRunnerMessage and removed - users should use ShardRunnerMessage directly instead.
  • The ShardManagerError type is removed in favor of GatewayError.
  • Serenity's handling of gateway heartbeats has been made more accurate and type safe as follows:
    • Removed Shard::heartbeat_instants. Users should instead use the last_heartbeat_{sent,ack} methods, which now return Option<Instant> instead of Option<&Instant>.
    • Changed Shard::heartbeat_interval to return Option<Duration> instead of Option<u64>.
    • Rename Shard::check_heartbeat to do_heartbeat.
  • ShardMessenger::new now takes &ShardRunner as argument instead of Sender<ShardRunnerMessage>.
  • Removed the ShardRunnerMessage::AddCollector variant in favor of the ShardMessenger::add_collector method. This method adds the collectors immediately, whereas ShardRunnerMessage is polled periodically in a loop - this could occasionally cause collectors to drop the first event they received.
  • All remaining types found at serenity::client::bridge::{gateway,voice}::* have been moved into serenity::gateway. They are now gated behind the gateway feature instead of the client feature, however most users use these features in conjunction, and so should not see a change in required-enabled features.

MSRV

Serenity now uses Rust edition 2021, with an MSRV of Rust 1.74.

Miscellaneous

Added

  • #1923, #2465 - Add a thread_id parameter to Http::{get,edit,delete}_webhook_message, Http::execute_webhook}, as well as Webhook::{get,delete}_message.
  • #2104, #2105 - Add an audit_log_reason parameter to many Http methods and builder structs.
  • #2164 - Add EventHandler::shards_ready method.
  • #2186, #2201 - Add support for having a bot interactions endpoint URL.
  • #2215 - Implement Default for many model types.
  • #2233 - Add button and select_menu methods to the following builders:
    • CreateInteractionResponseMessage
    • CreateInteractionResponseFollowup
    • EditInteractionResponse
    • CreateMessage
    • EditMessage
    • EditWebhookMessage
    • ExecuteWebhook
  • #2247, #2357, #2385 - Add support for forum channels and creating forum posts using ChannelId::create_forum_post and GuildChannel::create_forum_post.
  • #2257 - Add support for multiple event handlers by replacing the event_handler and raw_event_handler fields with pluralized event_handlers and raw_event_handlers in the following structs:
    • ShardManagerOptions
    • ShardQueuer
    • ShardRunner
    • ShardRunnerOptions
    • ClientBuilder
  • #2273, #2367 - Add events ReactionRemoveEmoji and GuildAuditLogEntryCreate.
  • #2276 - Add support for automod regex patterns.
  • #2297 - Add the serenity::all module, which re-exports most public items in the crate.
  • #2336 - Add a CreateButton::custom_id method.
  • #2369 - Add support for editing a guild's MFA level using {GuildId, Guild, PartialGuild}::edit_mfa_level.
  • #2391 - Add attachments support to the EditWebhookMessage endpoint by adding a new_attachments parameter to Http::edit_webhook_message, as well as the following methods to the EditWebhookMessage builder:
    • attachment
    • add_existing_attachment
    • remove_existing_attachment
  • #2415, #2461 - Add support for Discord's new usernames by adding the User::global_name field, and by making discriminators on usernames optional and non-zero. In particular, the PresenceUser::discriminator and User::discriminator fields are now of type Option<NonZeroU16>.
  • #2487 - Add support for the Get Current User Guild Member endpoint with the {GuildId,Guild,PartialGuild}::current_user_member method.
  • #2503 - Add support for setting custom activity statuses.
  • #2520 - Add the User::static_face method, mirroring User::face.
  • #2535 - Add pagination support to the Get Guild Bans endpoint.
  • #2565 - Add support for the VOICE_CHANNEL_STATUS_UPDATE gateway event.
  • #2576 - Add a GuildId::everyone_role method.
  • #2588 - Add audit log events for creator monetization.
  • #2595 - Add the CREATE_EVENTS and CREATE_GUILD_EXPRESSIONS permissions, and rename MANAGE_EMOJIS_AND_STICKERS to MANAGE_GUILD_EXPRESSIONS (the old name is still present but deprecated).
  • #2600 - Add the FormattedTimestamp utility struct for representing a combination of a timestamp and a formatting style.
  • #2601 - Add support for more Discord subdomains in utils::argument_convert::parse_message_url.
  • #2614 - Add Hash to Timestamp's derive list.
  • #2592 - Add experimental typesize support.
  • #2618 - Implement From<Into<String>> for AutocompleteChoice.

Changed

  • #1896 - Request::body_ref now returns Option<&T> instead of &Option<&T>.
  • #1897, #2350 - Typing::stop now returns bool instead of Option<()>. Also, Typing::start and any wrapper methods are now infallible.
  • #1922, #1940, #2090 - The following methods are no longer async:
    • ChannelId::name
    • Context::*
    • Guild::{members_starting_with, members_containing, members_username_containing, members_nick_containing}
    • Guild::default_channel
    • PartialGuild::greater_member_hierarchy
    • ShardManager::new
    • UserId::to_user_cached
  • #1929 - Unbox the Error::Http variant.
  • #1934 - Change Guild::member to return Cow<'_, Member> instead of just Member.
  • #1937 - Change all fields of ShardManagerOptions to be owned (Arc is cheap to clone).
  • #1947 - Change methods related to pruning to take and return u8.
  • #1963 - Change RequestBuilder::body from Option<&[u8]> to Option<Vec<u8>>.
  • #1976 - Make MessageInteraction non-exhaustive, and add a member field.
  • #1977 - Rename Permissions::USE_SLASH_COMMANDS to USE_APPLICATION_COMMANDS.
  • #1980 - Rename constants::OpCode to Opcode, and the same for voice_model::OpCode.
  • #1984 - Introduce ShardInfo for tracking Shard ids, and change ids from u64 to u32.
  • #1990 - Change the Message::nonce field to a custom Nonce enum instead of a serde_json::Value.
  • #1999 - Make MembershipState, ScheduledEventStatus, and ScheduledEventType non-exhaustive.
  • #2005 - Change MessageActivityKind variants to use CamelCase instead of ALL_CAPS.
  • #2007, #2018 - Rework presence setting and storing as follows:
    • Replace CurrentPresence with a PresenceData struct.
    • Use ActivityData in place of Activity for setting the current presence.
    • Change the various set_activity methods to take an Option<ActivityData> to allow for clearing the current presence by passing in None.
    • Add support for setting a presence when first identifying to the gateway by adding presence methods to ClientBuilder, and adding an optional presence parameter to Shard::new.
  • #2008 - Unknown values for enum variants are now preserved for debugging purposes. Any Unknown variants on enums are now changed to Unknown(u8). Also, the num method for those enums is removed; users should call u8::from instead.
  • #2017 - Change Member::edit to edit in place, and return Result<()> instead of Result<Message>.
  • #2023, #2170, #2459 - Use Id types everywhere instead of u32, u64, or NonZeroU64.
  • #2030 - Change {GuildId, Guild, PartialGuild}::delete to return Result<()>.
  • #2032 - Replace impl From<String> for Timestamp with impl TryFrom<&str>.
  • #2047 - The following functions are now const:
    • LightMethod::reqwest_method
    • Ratelimit::{limit, remaining, reset, reset_after}
    • RequestBuilder::new
    • Channel::{id, position, name}
    • Error::is_cache_err
    • Event::event_type
    • EventType::name
    • GatewayIntents::*
    • Permissions::*
  • #2052 - Change the CommonFilterOptions::{filter_limit, collect_limit} fields from u32 to NonZeroU32.
  • #2054 - Change the GuildChannel::message_count field from Option<u8> to Option<u32>.
  • #2073 - Move the serenity::utils::colour module into serenity::model.
  • #2127 - Replace CreateAllowedMentions::parse with all_users, all_roles, and everyone methods.
  • #2139 - Change ChannelId::name to return Result<String> instead of Option<String>.
  • #2144 - Don't offer different function signatures for EventHandler methods if the cache feature is disabled. Relevant cache-dependant data is now passed in using Option.
  • #2149 - Change channel positions, role positions, and bitrates to always be u32.
  • #2173 - Replace the implementation of Future for ClientBuilder with IntoFuture.
  • #2173 - Make ClientBuilder::{get_token, get_type_map, get_cache_settings} infallible.
  • #2194 - Change CacheUpdate::Output for ChannelDeleteEvent from () to Vec<Message>.
  • #2205 - Wrap the following large model fields in Box:
    • CommandInteraction::member
    • ComponentInteraction::message
    • ModalInteraction::message
    • Message::member
    • Message::interaction
  • #2224 - Introduce CreateSelectMenuKind and ComponentInteractionDataKind enums to better enforce well-formation of requests.
  • #2244 - Flatten the http module by re-exporting all types found in submodules at the top level and removinng access to the submodules themselves.
  • #2277 - Make ErrorResponse non-exhaustive, change the url field from Url to String, and add a method field.
  • #2285 - Wrap the Http::ratelimiter field in Option, and remove the corresponding ratelimiter_disabled field.
  • #2285 - Add an optional reason parameter to Http::{ban, kick}, and remove Http::{ban,kick}_with_reason.
  • #2288 - Merge the Route and RouteInfo enums, and add method and params fields to the Request struct.
  • #2310 - Flatten the model::application module in the same way the http module was flattened.
  • #2327 - Change the ThreadMembersUpdateEvent::member_count field from u8 to i16.
  • #2393 - Change the following field and enum variant types:
    • GuildUpdateEvent::guild from PartialGuild to Guild
    • Reaction::member from Option<PartialMember> to Member
    • Integration::guild_id from GuildId to Option<GuildId>
    • IncidentUpdate::status from IncidentStatus to String (IncidentStatus is also removed)
    • {Guild,PartialGuild}::premium_subscription_count from u64 to Option<u64>
    • InputText::value from String to Option<String>
    • CurrentApplicationInfo::owner from User to Option<User>
    • ScheduledEventMetadata::location from String to Option<String>
    • Trigger::KeywordPreset from a tuple variant to a struct variant
  • #2393 - Rename the following field and enum variants:
    • Incident::short_link to shortlink
    • ThreadDeleteEvent::channels_id to channel_ids
    • ThreadMembersUpdateEvent::removed_members_ids to removed_member_ids
    • InviteTargetType::EmmbeddedApplication to EmbeddedApplication
    • Scope::RelactionshipsRead to RelationshipsRead
  • #2393, #2418 - Change CurrentUser to be a newtype around User, implement the Deref trait, and remove the guilds, invite_url, and invite_url_with_oauth2_scopes methods. The only method now unique to CurrentUser is edit. All other methods are available to call via deref coercion.
  • #2397 - Make the following model types non-exhaustive:
    • model::application::{Interaction, ActionRow, Button, SelectMenu, SelectMenuOption, InputText}
    • model::application::{PartialCurrentApplicationInfo, Team, TeamMember, InstallParams}
    • model::channel::{PartialGuildChannel, ChannelMention}
    • model::gateway::{ActivityEmoji, ClientStatus}
    • model::guild::{Ban, GuildPrune, GuildInfo, UnavailableGuild, GuildWelcomeScreen}
    • model::guild::{ScheduledEventMetadata, ScheduledEventUser}
    • model::guild::automod::{Rule, TriggerMetadata, Action, ActionExecution}
    • model::misc::EmojiIdentifier
  • #2428 - Change CacheUpdate::Output for ChannelUpdateEvent from () to Channel. Also, make {Guild,PartialGuild}::user_permissions_in infallible and change Error::InvalidPermissions into a struct variant containing both the the required permissions as well as the present permissions.
  • #2460 - Wrap secret tokens in secrecy::SecretString to prevent them being leaked through Debug implementations, and so that they are zeroed when dropped.
  • #2462, #2467, #2586 - Change image hashes from Strings to a dedicated ImageHash type which saves on space by storing the hash directly as bytes.
  • #2464 - Optimize the size of many model structs by changing the types of their fields:
    • All rate_limit_per_user fields are now counted using a u16.
    • Channel position fields now hold a u16.
    • Role positition fields now hold a u16.
    • All auto_archive_position fields are now an enum AutoArchivePosition.
    • All afk_timeout fields are now an enum AfkTimeout.
    • Replace the DefaultReaction struct with a ForumEmoji enum.
    • The Sticker::sort_value field is now an Option<u16>.
    • The min_values and max_values fields for Select Menus now hold a u8.
    • The max_age invite field now holds a u32.
    • The max_uses invite field now holds a u8.
    • The ActivityParty current and maximum size are now of type u32.
    • The Ready::version field is now a u8.
    • The min_length and max_length fields for Input Text components now hold a u16.
    • The mention_total_limit field for automod triggers now holds a u8.
    • The RoleSubscriptionData::total_months_subscribed field is now a u16.
  • #2470 - Rename {Http,ChannelId,GuildChannel}::create_public_thread to create_thread_from_message, and similarly rename create_private_thread to create_thread, to more accurately reflect their behavior. The corresponding endpoints have also been renamed from ChannelPublicThreads/ChannelPrivateThreads, to ChannelMessageThreads/ChannelThreads, respectively.
  • #2519 - Make stage channels text-based.
  • #2551 - The ThreadDelete event now provides the full GuildChannel object for the deleted thread if it is present in the cache.
  • #2553 - The ThreadUpdate event now provides the old thread's GuildChannel object if it is present in the cache.
  • #2554 - The Webhook::source_guild and Webhook::source_channel fields have had their types changed from Option<PartialGuild>/Option<PartialChannel> to their own Option<WebhookGuild>/Option<WebhookChannel> types in order to avoid deserialization errors. These new types contain very few fields, but have methods for converting into PartialGuilds or Channels by querying the API.
  • #2569 - Replaced the json::prelude module with public wrapper functions that abstract over both serde_json and simd-json.
  • #2593 - Rename GatewayIntents::GUILD_BANS to GUILD_MODERATION (the old name is still present but is deprecated).
  • #2598 - Change CreateInteractionResponseMessage::flags to take InteractionResponseFlags instead of MessageFlags.
  • #2609 - Split parts of ThreadMember into PartialThreadMember.
  • #2622 - Implement role addition/removal using dedicated endpoints.
  • #2623 - Use dedicated types for GuildId::audit_logs.
  • #2625 - Change Guild::members_with_status to return impl Iterator<Item = &Member> instead of Vec<Member>.

Removed

  • #1864, #1902 - Remove all deprecated types, fields, and methods.
  • #1885 - Remove the lifetime parameter on model::application::ResolvedTarget.
  • #1927 - Remove model::guild::GuildContainer.
  • #1938 - Remove EventHandler::{guild_unavailable, unknown}.
  • #1959 - Remove EditProfile::{email, password, new_password}.
  • #2034 - Remove serenity::json::from_number. Users should call .into() instead.
  • #2128 - Remove the Channel::Category variant, as GuildChannel::kind can already be ChannelType::Category. However, the Channel::category method is still available.
  • #2161 - Remove the Mention::Emoji variant.
  • #2162 - Remove serenity::token::parse - use token::validate instead.
  • #2246 - Remove the absolute_ratelimits feature and replace it with a runtime configuration option.
  • #2308 - Remove CacheAndHttp, and inline it as separate cache and http fields in the following structs:
    • ShardManagerOptions
    • ShardQueuer
    • ShardRunner
    • ShardRunnerOptions
    • Client
  • #2393 - Remove non-existent fields and enum variants that Discord no longer sends back from the API. The following fields have been removed:
    • VoiceServerUpdateEvent::channel_id
    • ResumedEvent::channel_id
    • Ready::{presences, private_channels, trace}
    • InviteGuild::{text_channel_count, voice_channel_count}
    • VoiceState::token
    • IncidentUpdate::affected_components (and also the AffectedComponent struct)
    • Maintenance::{description, stop, start}
    • SelectMenu::values
    • MessageUpdateEvent::{author, timestamp, nonce, kind, stickers}
    • PartialGuild::{owner, permissions}
    • InviteTargetType::Normal
    • Trigger::HarmfulLink
  • #2424 - Remove the FromStrAndCache and StrExt traits. Also removes model::{ChannelParseError,RoleParseError}, which conflicted with types of the same name from utils.
  • #2429 - Remove the useless re-exports of the various submodules of model from the model::prelude, and don't re-export types from other libraries, like Deserialize or HashMap.
  • #2466 - Remove the DefaultAvatar enum.
  • #2531 - The following bitflag types no longer implement PartialOrd/Ord:
    • ActivityFlags
    • ApplicationFlags
    • ChannelFlags
    • GatewayIntents
    • GuildMemberFlags
    • InteractionResponseFlags
    • MessageFlags
    • Permissions
    • SpeakingState
    • SystemChannelFlags
    • ThreadMemberFlags
    • UserPublicFlags
  • #2559 - Remove the EventType enum. Instead of Event::event_type().name(), users should just call Event::name.
  • #2578 - Remove the PingInteraction::guild_locale field.

v0.12.0-rc2

4 months ago

This is the second iteration of 0.12's Release Candidate. Notable inclusions since the prior iteration are:

v0.12.0-rc

5 months ago

This is the Release Candidate for v0.12.0. For the list of changes made (which there are a ton), see the CHANGELOG file at the root of the repository.

v0.11.7

5 months ago

Thanks to the following for their contributions:

Notable changes

  • (#2493) Add MessageComponentInteraction::edit_original_message() for editing the original message of the message component.
  • (#2504) Implement std::str::FromStr for the ID types to allow converting from a string. This does not affect the pre-existing implementation on ChannelId, RoleId, and UserId.
  • (#2506) Add missing set_components() methods on EditInteractionResponse and EditWebhookMessage
  • (#2533) Add additional delete_reaction and delete_reactions methods for deleting reactions to ChannelId, GuildChannel, and Message.
  • (#2562) Bump base64 dependency to 0.21

v0.11.6

9 months ago

Special thanks to @mkrasnitski for writing this changelog :heart:

Thanks to the following for their contributions:

Notable changes

  • (#2076) Make Timestamp usable regardless of the chrono or time features.
  • (#2077) Deprecate modifying command application permissions in bulk. The corresponding endpoint is already deprecated by Discord.
  • (#2130) Standard Framework: Implicitly set BucketBuilder::await_ratelimits to 1 upon BucketBuilder::delay_action being set.
  • (#2133) Add Voice channels to the list of text-based channel types.
  • (#2136) Add an event for HTTP ratelimits, and a corresponding EventHandler::ratelimit method.
  • (#2154) Add the following fields to MessageUpdateEvent:
    • mention_channels
    • reactions
    • components
    • sticker_items
  • (#2155) Expose Shard::handle_event publicly.
  • (#2214) Add User::member, as well as Message:{thread, application_id} fields.
  • (#2223, #2290) Add a defer_ephemeral helper method to many interaction types.
  • (#2265) Add as_* and into_* helper methods to the Interaction type for converting to each of its respective variants.
  • (#2281) Add the UserPublicFlags::ACTIVE_DEVELOPER flag.
  • (#2298) Add the following fields to guild channel, relevant for forums:
    • flags
    • total_messages_sent
    • available_tags
    • applied_tags
    • default_reaction_emoji
    • default_thread_rate_limit_per_user
    • default_sort_order
  • (#2330) Add support for owner_id in thread and forum channels.
  • (#2346) Add the SUPPRESS_NOTIFICATIONS message flag.
  • (#2431) Add support for getting application commands with localizations via the following methods:
    • Http::get_{guild,global}_application_commands_with_localizations
    • Command::get_global_application_commands_with_localizations
    • {GuildId,Guild,PartialGuild}::get_application_commands_with_localizations
  • (#2444) Add a remove_all_attachments method to EditMessage.

v0.11.5

1 year ago

Thanks to the following for their contributions:

Notable changes

  • Make select menu values optional to fix deserialization of message component interactions (@bumblepie)

v0.11.4

1 year ago

Thanks to the following for their contributions:

Notable changes

  • Fix deserialization error of GuildChannel::message_count (@anden3)

v0.11.3

1 year ago

Thanks to the following for their contributions:

Notable changes

  • Temporarily fix GuildChannel::message_count in a non-breaking way (@GnomedDev)
  • Add support for Auto Moderation feature (@nickelc)
  • Add optional min/max length fields for application command string options (@nickelc)
  • Allow select menu response for modals (@AlexisTM)
  • Add app_permissions field on interactions (@nickelc)
  • Enable Invite::expires_at field (@mkrasnitski)
  • Fix "missing field discriminator" serde error for presence updates (@nickelc)
  • Add webhook example (@NotNorom)
  • Introduce rustversion dependency and backports module (@GnomedDev)
  • Add MessageType::AutoModerationAction enum variant (@nickelc)
  • Attempt to fix lifetime bug around CustomisedHelpData (@mkrasnitski)
  • Auto-impl CacheHttp for Arc<T> if T also implements it (@mkrasnitski)
  • Add audit log action types for scheduled events (@nickelc)
  • Fill gaps in all model::application types (@kangalioo)
  • Add support for slash command localization (@kangalioo)
  • Implement announcement channel following (@GnomedDev)
  • Add event handler methods for scheduled events (@nickelc)
  • Add methods to Webhook to enable direct creation (@mkrasnitski)
  • Consolidate interactions & oauth2 model types into the application module (@nickelc)
  • Fix compile errors in builders when the model feature is disabled (@FallenWarrior2k)

v0.11.2

1 year ago

Thanks to the following for their contributions:

Added

Changed

Fixed

Removed