#[non_exhaustive]
pub struct Reaction { pub channel_id: ChannelId, pub emoji: ReactionType, pub message_id: MessageId, pub user_id: Option<UserId>, pub guild_id: Option<GuildId>, pub member: Option<PartialMember>, }
Expand description

An emoji reaction to a message.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
channel_id: ChannelId

The Channel of the associated Message.

emoji: ReactionType

The reactive emoji used.

message_id: MessageId

The Id of the Message that was reacted to.

user_id: Option<UserId>

The Id of the User that sent the reaction.

Set to None by Message::react when cache is not available.

guild_id: Option<GuildId>

The optional Id of the Guild where the reaction was sent.

member: Option<PartialMember>

The optional object of the member which added the reaction.

Implementations

Available on crate feature model only.

Retrieves the associated the reaction was made in.

If the cache is enabled, this will search for the already-cached channel. If not - or the channel was not found - this will perform a request over the REST API for the channel.

Requires the Read Message History permission.

Errors

Returns Error::Http if the current user lacks permission, or if the channel no longer exists.

Available on crate feature model only.

Deletes the reaction, but only if the current user is the user who made the reaction or has permission to.

Requires the Manage Messages permission, if the current user did not perform the reaction.

Errors

If the cache is enabled, then returns a ModelError::InvalidPermissions if the current user does not have the required permissions.

Otherwise returns Error::Http if the current user lacks permission.

Available on crate feature model only.

Deletes all reactions from the message with this emoji.

Requires the Manage Messages permission

Errors

If the cache is enabled, then returns a ModelError::InvalidPermissions if the current user does not have the required permissions.

Otherwise returns Error::Http if the current user lacks permission.

Available on crate feature model only.

Retrieves the Message associated with this reaction.

Requires the Read Message History permission.

Note: This will send a request to the REST API. Prefer maintaining your own message cache or otherwise having the message available if possible.

Errors

Returns Error::Http if the current user lacks permission to read message history, or if the message was deleted.

Available on crate feature model only.

Retrieves the user that made the reaction.

If the cache is enabled, this will search for the already-cached user. If not - or the user was not found - this will perform a request over the REST API for the user.

Errors

Returns Error::Http if the user that made the reaction is unable to be retrieved from the API.

Available on crate feature model only.

Retrieves the list of Users who have reacted to a Message with a certain Emoji.

The default limit is 50 - specify otherwise to receive a different maximum number of users. The maximum that may be retrieve at a time is 100, if a greater number is provided then it is automatically reduced.

The optional after attribute is to retrieve the users after a certain user. This is useful for pagination.

Requires the Read Message History permission.

Note: This will send a request to the REST API.

Errors

Returns a ModelError::InvalidPermissions if the current user does not have the required permissions.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more