pub struct IncomingMessage {Show 14 fields
pub message_id: Option<String>,
pub wire_message_id: Option<i64>,
pub client_id: String,
pub user_id: String,
pub text: String,
pub content_type: ContentType,
pub timestamp: SystemTime,
pub images: Vec<ImageContent>,
pub voices: Vec<VoiceContent>,
pub files: Vec<FileContent>,
pub videos: Vec<VideoContent>,
pub quoted: Option<QuotedMessage>,
pub raw: WireMessage,
pub context: Option<WechatContext>,
/* private fields */
}Expand description
Parsed incoming message — user-friendly.
Fields§
§message_id: Option<String>§wire_message_id: Option<i64>§client_id: String§user_id: String§text: String§content_type: ContentType§timestamp: SystemTime§images: Vec<ImageContent>§voices: Vec<VoiceContent>§files: Vec<FileContent>§videos: Vec<VideoContent>§quoted: Option<QuotedMessage>§raw: WireMessage§context: Option<WechatContext>Context observed from this message, including the account key.
Implementations§
Source§impl IncomingMessage
impl IncomingMessage
Sourcepub fn context_token(&self) -> &str
pub fn context_token(&self) -> &str
Opaque reply token bound to this message.
Prefer the full context with
WechatIlinkClient::send_text_with_context
or WechatIlinkClient::reply, which uses it automatically.
Use this getter only when constructing low-level protocol payloads with
protocol::build_text_message /
protocol::build_media_message
for ILinkClient::send_message.
Sourcepub fn from_wire_for_account(
wire: &WireMessage,
account_key: &str,
) -> Option<Self>
pub fn from_wire_for_account( wire: &WireMessage, account_key: &str, ) -> Option<Self>
Parse a raw WireMessage into a user-friendly IncomingMessage,
associating the context with the given account key.
Prefer this over from_wire when the account key
is known, so that context carries correct
WechatContext::account_key information.
Returns None if the wire message is not a user-originated message
(e.g. it was sent by the bot itself).
Sourcepub fn from_wire(wire: &WireMessage) -> Option<Self>
pub fn from_wire(wire: &WireMessage) -> Option<Self>
Parse a raw WireMessage into a user-friendly IncomingMessage.
Uses a fallback account key derived from the wire message. When the
account key is known, prefer from_wire_for_account.
Returns None if the wire message is not a user-originated message
(e.g. it was sent by the bot itself).
This is the stable entry point for consumers who drive
ILinkClient::get_updates
themselves instead of using WechatIlinkClient’s
dispatcher.
Trait Implementations§
Source§impl Clone for IncomingMessage
impl Clone for IncomingMessage
Source§fn clone(&self) -> IncomingMessage
fn clone(&self) -> IncomingMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more