2023-02-26 Updates
We've published minor versions of a number of crates. In a recent campaign to improve documentation when support tickets are received in our Discord server, these releases largely contain improved documentation. The remainder of the releases are dedicated to new Discord API features.
Get Thread Members Request Pagination
The GetThreadMembers
HTTP request now supports pagination via the usual
after
and limit
methods. It defaults to returning a subset of information about the users in a
given thread, but supports specifying whether to retrieve the
full member details of those users.
Unknown Shard Event Behavior
Gateway shards allow receiving Websocket messages or
the next Gateway event. Discord sends events that are
undocumented, which Twilight doesn't support. Additionally, there may be new
events Twilight doesn't immediately support. However, an error would be returned
when an unimplemented event is encountered due to a parsing error. We've changed
iteration over events to ignore unknown events. Iterating over websocket
messages and parsing them via twilight_gateway::parse
should be preferred
when an event Twilight doesn't support is required.
Message Notification Suppression
Notifications about messages can now be suppressed via a new message flag,
SUPPRESS_NOTIFICATIONS
. It can be
specified in the CreateMessage
and
CreateForumThreadMessage
HTTP requests.
Stage Channel Message Types
Discord launched text-in-stage, which is much like text-in-voice. It includes four new message types, with all being system messages:
MessageType::StageEnd
, denoting when a stage ends;MessageType::StageSpeaker
, denoting when a member becomes a speaker;MessageType::StageStart
, denoting when a stage starts; andMessageType::StageTopic
, denoting when the topic of the stage changes.
Custom AutoMod Block Messages
Discord recently launched custom messages for AutoMod block message actions.
Custom messages can be added to rules via
CreateAutoModerationRule::action_block_message_with_explanation
.
Group OAuth2 Management
Channels have a new field called managed
, which specifies
whether a group is managed by an application via the gdm.join
OAuth2 scope.
Gateway OpCode Categorization
Helpful for those working with the lower levels of the gateway, the gateway
OpCode
type has two new methods: is_received
and
is_sent
. These can be used to determine whether an OpCode
is meant to be received or sent. While many OpCodes can either be received or
sent, some can be received and sent, so the categorization can be helpful.