#[non_exhaustive]pub struct MessageReference {
pub kind: MessageReferenceType,
pub message_id: Option<MessageId>,
pub channel_id: Option<ChannelId>,
pub guild_id: Option<GuildId>,
pub fail_if_not_exists: Option<bool>,
}Expand description
A reference from one message to another: a reply or a forward.
See the message reference object.
discord.js counterpart: MessageReference / Message#reference.
§Examples
Referencing a message to reply to it:
use djs_model::{id::MessageId, message::MessageReference};
let reply = MessageReference::reply(MessageId::new(1_300_000_000_000_000_000));
assert_eq!(
serde_json::to_string(&reply).unwrap(),
r#"{"type":0,"message_id":"1300000000000000000"}"#
);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.kind: MessageReferenceTypeThe kind of reference. Defaults to MessageReferenceType::Default (a reply) when
absent.
message_id: Option<MessageId>The ID of the referenced message.
channel_id: Option<ChannelId>The ID of the referenced message’s channel.
Optional when sending a reply, required when forwarding, always present when received.
guild_id: Option<GuildId>The ID of the referenced message’s guild.
fail_if_not_exists: Option<bool>When sending: whether to fail if the referenced message does not exist (Discord’s default
is true) instead of sending a normal, non-reply message.
Implementations§
Trait Implementations§
Source§impl Clone for MessageReference
impl Clone for MessageReference
impl Copy for MessageReference
Source§impl Debug for MessageReference
impl Debug for MessageReference
Source§impl<'de> Deserialize<'de> for MessageReference
impl<'de> Deserialize<'de> for MessageReference
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 MessageReference
Source§impl Hash for MessageReference
impl Hash for MessageReference
Source§impl PartialEq for MessageReference
impl PartialEq for MessageReference
Source§impl Serialize for MessageReference
impl Serialize for MessageReference
impl StructuralPartialEq for MessageReference
Auto Trait Implementations§
impl Forget for MessageReference
impl Freeze for MessageReference
impl Move for MessageReference
impl RefUnwindSafe for MessageReference
impl Send for MessageReference
impl Sync for MessageReference
impl Unpin for MessageReference
impl UnsafeUnpin for MessageReference
impl UnwindSafe for MessageReference
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