pub struct MessageContext {
pub message: Arc<Message>,
pub info: MessageInfo,
pub client: Arc<Client>,
}Expand description
message is Arc so cloning the context across spawned tasks only bumps a
refcount, matching the pattern used by serenity’s Context and matrix-sdk’s
Room/Client.
Fields§
§message: Arc<Message>§info: MessageInfo§client: Arc<Client>Implementations§
Source§impl MessageContext
impl MessageContext
Sourcepub fn from_parts(
message: &Message,
info: &MessageInfo,
client: Arc<Client>,
) -> Self
pub fn from_parts( message: &Message, info: &MessageInfo, client: Arc<Client>, ) -> Self
Builds a context from borrowed parts, deep-cloning message. Prefer
MessageContext::from_arc/MessageContext::from_inbound when an
Arc<wa::Message> is already at hand (the event bus always has one).
pub fn from_arc( message: Arc<Message>, info: &MessageInfo, client: Arc<Client>, ) -> Self
pub fn from_inbound(inbound: &InboundMessage, client: Arc<Client>) -> Self
pub async fn send_message( &self, message: Message, ) -> Result<SendResult, SendError>
Sourcepub async fn reply(
&self,
text: impl Into<String>,
) -> Result<SendResult, SendError>
pub async fn reply( &self, text: impl Into<String>, ) -> Result<SendResult, SendError>
Reply with plain text in the same chat, without quoting.
Sourcepub async fn reply_quoting(
&self,
text: impl Into<String>,
) -> Result<SendResult, SendError>
pub async fn reply_quoting( &self, text: impl Into<String>, ) -> Result<SendResult, SendError>
Reply with plain text, quoting the received message.
pub fn build_quote_context(&self) -> ContextInfo
Sourcepub fn message_key(&self) -> MessageKey
pub fn message_key(&self) -> MessageKey
Referential wa::MessageKey for wa::message::ReactionMessage::key.
Sender-side revokes have a different shape; use Client::revoke_message.
pub async fn edit_message( &self, original_message_id: impl Into<String>, new_message: Message, ) -> Result<String, SendError>
Sourcepub async fn revoke_message(
&self,
message_id: impl Into<String>,
revoke_type: RevokeType,
) -> Result<(), SendError>
pub async fn revoke_message( &self, message_id: impl Into<String>, revoke_type: RevokeType, ) -> Result<(), SendError>
Delete a message for everyone in the chat.
Sourcepub async fn react(&self, emoji: &str) -> Result<SendResult, SendError>
pub async fn react(&self, emoji: &str) -> Result<SendResult, SendError>
React to the incoming message. An empty emoji removes a previous
reaction. The target key (including the group/status participant) is
taken from MessageContext::message_key.
Trait Implementations§
Source§impl Clone for MessageContext
impl Clone for MessageContext
Source§fn clone(&self) -> MessageContext
fn clone(&self) -> MessageContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for MessageContext
impl !UnwindSafe for MessageContext
impl Freeze for MessageContext
impl Send for MessageContext
impl Sync for MessageContext
impl Unpin for MessageContext
impl UnsafeUnpin for MessageContext
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more