#[non_exhaustive]pub enum ReferencedMessage {
NotFetched,
Deleted,
Message(Box<Message>),
}Expand description
The message a reply (or thread starter, or context menu command message) refers to (D-061).
Discord distinguishes an absent field (“did not try to fetch it”) from null (“it was
deleted”); this type keeps that distinction.
discord.js counterpart: Message#fetchReference’s message; the referenced_message of APIMessage (discord-api-types).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotFetched
The field was absent: Discord did not try to fetch the message, so its state is unknown (also the case for messages of other types).
Deleted
The field was null: the referenced message was deleted.
Message(Box<Message>)
The referenced message.
Implementations§
Source§impl ReferencedMessage
impl ReferencedMessage
Sourcepub fn as_message(&self) -> Option<&Message>
pub fn as_message(&self) -> Option<&Message>
Returns the referenced message, if Discord sent it.
discord.js counterpart: Message#fetchReference.
Sourcepub fn into_message(self) -> Option<Box<Message>>
pub fn into_message(self) -> Option<Box<Message>>
Converts into the referenced message, if Discord sent it.
discord.js counterpart: Message#fetchReference.
Sourcepub const fn is_not_fetched(&self) -> bool
pub const fn is_not_fetched(&self) -> bool
Whether the field was absent (the state of the referenced message is unknown).
discord.js counterpart: none (discord.js fetches the reference on demand).
Sourcepub const fn is_deleted(&self) -> bool
pub const fn is_deleted(&self) -> bool
Whether the referenced message was deleted.
discord.js counterpart: none (Message#fetchReference rejects for a deleted message).
Trait Implementations§
Source§impl Clone for ReferencedMessage
impl Clone for ReferencedMessage
Source§impl Debug for ReferencedMessage
impl Debug for ReferencedMessage
Source§impl Default for ReferencedMessage
impl Default for ReferencedMessage
Source§impl<'de> Deserialize<'de> for ReferencedMessage
impl<'de> Deserialize<'de> for ReferencedMessage
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Reads null as Deleted and an object as the message. An absent field
becomes NotFetched through #[serde(default)].