pub struct Message {Show 21 fields
pub id: String,
pub content: String,
pub replied_to: String,
pub replied_to_content: Option<String>,
pub replied_to_npub: Option<String>,
pub replied_to_has_attachment: Option<bool>,
pub replied_to_attachment_extension: Option<String>,
pub preview_metadata: Option<SiteMetadata>,
pub attachments: Vec<Attachment>,
pub reactions: Vec<Reaction>,
pub at: u64,
pub expiration: Option<u64>,
pub pending: bool,
pub failed: bool,
pub mine: bool,
pub npub: Option<String>,
pub wrapper_event_id: Option<String>,
pub edited: bool,
pub edit_history: Option<Vec<EditEntry>>,
pub emoji_tags: Vec<EmojiTag>,
pub addressed_bots: Vec<String>,
}Fields§
§id: String§content: String§replied_to: String§replied_to_content: Option<String>§replied_to_npub: Option<String>§replied_to_has_attachment: Option<bool>§replied_to_attachment_extension: Option<String>File extension of the replied-to attachment, when known. Lets the reply quote show the file type (Photo/Video/…) for off-screen targets the in-memory message can’t supply.
preview_metadata: Option<SiteMetadata>§attachments: Vec<Attachment>§reactions: Vec<Reaction>§at: u64§expiration: Option<u64>NIP-40 expiry (unix seconds). None = permanent. Set on Self-Destruct Timer messages; drives the live countdown and the local purge sweep.
pending: bool§failed: bool§mine: bool§npub: Option<String>§wrapper_event_id: Option<String>§edited: bool§edit_history: Option<Vec<EditEntry>>NIP-30 custom-emoji ["emoji", shortcode, url] tags that travelled
with the rumor. Empty for stock-emoji messages; frontend renderer
uses this map to swap :shortcode: for <img> before twemoji runs.
addressed_bots: Vec<String>["bot", <pubkey hex>] recipient tags that travelled with the rumor
(bot-command addressing), surfaced as npubs. Empty = untagged/broadcast:
any matching bot may answer. Populated on live parse only (not persisted
— commands are actioned at delivery, never replayed from history).
Implementations§
Source§impl Message
impl Message
pub fn get_attachment_mut(&mut self, id: &str) -> Option<&mut Attachment>
Sourcepub fn apply_edit(
&mut self,
new_content: String,
edited_at: u64,
emoji_tags: Vec<EmojiTag>,
)
pub fn apply_edit( &mut self, new_content: String, edited_at: u64, emoji_tags: Vec<EmojiTag>, )
Apply an edit to this message, updating content and tracking history.
emoji_tags are the NIP-30 custom-emoji tags resolved from the new
content. They’re adopted only when this edit becomes the newest
revision, so an out-of-order older edit can’t clobber the live
content’s emoji.
Sourcepub fn add_reaction(&mut self, reaction: Reaction) -> bool
pub fn add_reaction(&mut self, reaction: Reaction) -> bool
Add a reaction. Returns true if the reaction was new.
Unlike the src-tauri version, this does NOT emit events — the caller
is responsible for notifying the UI via emit_event.
Sourcepub fn mentions(&self, npub: &str) -> bool
pub fn mentions(&self, npub: &str) -> bool
Check if this message mentions a specific npub (e.g. @npub1abc...).
Sourcepub fn mentions_me(&self) -> bool
pub fn mentions_me(&self) -> bool
Check if this message mentions the current user.
Sourcepub fn mentions_everyone(&self) -> bool
pub fn mentions_everyone(&self) -> bool
Check if this message contains an @everyone ping.
Sourcepub fn mentioned_npubs(&self) -> Vec<&str>
pub fn mentioned_npubs(&self) -> Vec<&str>
Extract all mentioned npubs from the message content.
Returns a list of npub strings (without the @ prefix) found in the message.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Message, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Message, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Message
impl Serialize for Message
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more