#[non_exhaustive]pub struct Reaction {
pub user_id: Option<UserId>,
pub channel_id: ChannelId,
pub message_id: MessageId,
pub guild_id: Option<GuildId>,
pub member: Option<Member>,
pub emoji: ReactionType,
pub message_author_id: Option<UserId>,
pub burst: bool,
pub burst_colours: Option<Vec<Colour>>,
pub reaction_type: ReactionTypes,
}Expand description
An emoji reaction to a message.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.user_id: Option<UserId>The Id of the User that sent the reaction.
Always present when received from gateway.
Set to None by Message::react when cache is not available.
channel_id: ChannelId§message_id: MessageIdThe Id of the Message that was reacted to.
guild_id: Option<GuildId>The optional Id of the Guild where the reaction was sent.
member: Option<Member>The optional object of the member which added the reaction.
Not present on the ReactionRemove gateway event.
emoji: ReactionTypeThe reactive emoji used.
The Id of the user who sent the message which this reacted to.
Only present on the ReactionAdd gateway event.
burst: boolIndicates if this was a super reaction.
burst_colours: Option<Vec<Colour>>Colours used for the super reaction animation.
Only present on the ReactionAdd gateway event.
reaction_type: ReactionTypesThe type of reaction.
Implementations§
Source§impl<'de> Reaction
impl<'de> Reaction
pub fn deserialize<__D>(__deserializer: __D) -> Result<Reaction, __D::Error>where
__D: Deserializer<'de>,
Source§impl Reaction
impl Reaction
Sourcepub async fn channel(&self, cache_http: impl CacheHttp) -> Result<Channel>
pub async fn channel(&self, cache_http: impl CacheHttp) -> Result<Channel>
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.
Sourcepub async fn delete(&self, cache_http: impl CacheHttp) -> Result<()>
pub async fn delete(&self, cache_http: impl CacheHttp) -> Result<()>
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.
Sourcepub async fn delete_all(&self, cache_http: impl CacheHttp) -> Result<()>
pub async fn delete_all(&self, cache_http: impl CacheHttp) -> Result<()>
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.
Sourcepub async fn message(&self, cache_http: impl CacheHttp) -> Result<Message>
pub async fn message(&self, cache_http: impl CacheHttp) -> Result<Message>
Retrieves the Message associated with this reaction.
Requires the Read Message History permission.
§Errors
Returns Error::Http if the current user lacks permission to read message history, or if
the message was deleted.
Sourcepub async fn user(&self, cache_http: impl CacheHttp) -> Result<User>
pub async fn user(&self, cache_http: impl CacheHttp) -> Result<User>
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.
Sourcepub async fn users<R, U>(
&self,
http: impl AsRef<Http>,
reaction_type: R,
limit: Option<u8>,
after: Option<U>,
) -> Result<Vec<User>>
pub async fn users<R, U>( &self, http: impl AsRef<Http>, reaction_type: R, limit: Option<u8>, after: Option<U>, ) -> Result<Vec<User>>
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.