#[non_exhaustive]pub struct Reaction {
pub count: u32,
pub count_details: ReactionCountDetails,
pub me: bool,
pub me_burst: bool,
pub emoji: PartialEmoji,
pub burst_colors: Vec<CompactString>,
}Expand description
A reaction to a message: one emoji and how often it was used.
discord.js counterpart: MessageReaction.
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.count: u32How many times the emoji was used, including super reactions.
count_details: ReactionCountDetailsThe count split into normal and super reactions.
me: boolWhether the current user reacted with this emoji.
me_burst: boolWhether the current user super-reacted with this emoji.
emoji: PartialEmojiThe emoji.
burst_colors: Vec<CompactString>The colors of the super reaction animation, as hex strings.
Implementations§
Source§impl Reaction
impl Reaction
Sourcepub fn new(emoji: PartialEmoji) -> Self
pub fn new(emoji: PartialEmoji) -> Self
Creates a reaction with emoji that nobody has used yet (all counts zero), to be
counted up — for example by a cache applying MESSAGE_REACTION_ADD.
discord.js counterpart: MessageReaction.
§Examples
use djs_model::{emoji::PartialEmoji, message::Reaction};
let mut reaction = Reaction::new(PartialEmoji::Unicode { name: "🔥".into() });
reaction.count += 1;
reaction.count_details.normal += 1;
assert_eq!(reaction.count, 1);
assert!(!reaction.me);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Reaction
impl<'de> Deserialize<'de> for Reaction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Reaction
impl StructuralPartialEq for Reaction
Auto Trait Implementations§
impl Freeze for Reaction
impl RefUnwindSafe for Reaction
impl Send for Reaction
impl Sync for Reaction
impl Unpin for Reaction
impl UnsafeUnpin for Reaction
impl UnwindSafe for Reaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more