[][src]Struct serenity::model::channel::Reaction

pub struct Reaction {
    pub channel_id: ChannelId,
    pub emoji: ReactionType,
    pub message_id: MessageId,
    pub user_id: UserId,
}

An emoji reaction to a message.

Fields

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: UserId

The Id of the User that sent the reaction.

Methods

impl Reaction[src]

pub fn channel(&self) -> Result<Channel>[src]

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.

pub fn delete(&self) -> Result<()>[src]

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.

pub fn message(&self) -> Result<Message>[src]

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.

pub fn user(&self) -> Result<User>[src]

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.

pub fn users<R, U>(
    &self,
    reaction_type: R,
    limit: Option<u8>,
    after: Option<U>
) -> Result<Vec<User>> where
    R: Into<ReactionType>,
    U: Into<UserId>, 
[src]

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

impl Clone for Reaction[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Reaction[src]

impl Serialize for Reaction[src]

impl<'de> Deserialize<'de> for Reaction[src]

Auto Trait Implementations

impl Send for Reaction

impl Sync for Reaction

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> DebugAny for T where
    T: Any + Debug
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<T> UnsafeAny for T where
    T: Any