pub struct MatrixContextData { /* private fields */ }Expand description
Matrix context data - implements ContextData for platform abstraction
Implementations§
Source§impl MatrixContextData
impl MatrixContextData
Sourcepub fn from_message(
event: &OriginalSyncRoomMessageEvent,
room: Room,
client: MatrixClient,
command_prefix: &str,
) -> Self
pub fn from_message( event: &OriginalSyncRoomMessageEvent, room: Room, client: MatrixClient, command_prefix: &str, ) -> Self
Create context from a room message event
Sourcepub fn from_reaction(
event: &OriginalSyncReactionEvent,
room: Room,
client: MatrixClient,
) -> Self
pub fn from_reaction( event: &OriginalSyncReactionEvent, room: Room, client: MatrixClient, ) -> Self
Create context from a reaction event
Sourcepub fn client(&self) -> &MatrixClient
pub fn client(&self) -> &MatrixClient
Get the client for making API calls
Sourcepub fn command(&self) -> Option<&str>
pub fn command(&self) -> Option<&str>
The command this message invokes, if any
Parsed once at construction, so routing and the CommandName extractor
always agree.
Sourcepub fn message_text(&self) -> Option<&str>
pub fn message_text(&self) -> Option<&str>
The message body, absent for non-text messages and reactions
Trait Implementations§
Source§impl ContextData for MatrixContextData
impl ContextData for MatrixContextData
fn channel_id(&self) -> &str
fn user_id(&self) -> &str
fn user_name(&self) -> &str
fn command_name(&self) -> Option<&str>
fn command_args(&self) -> Option<&str>
fn option(&self, _name: &str) -> Option<OptionValue>
fn message_content(&self) -> Option<&str>
fn as_any(&self) -> &dyn Any
Source§fn action_sender(&self) -> Option<AnyChatActionSender>
fn action_sender(&self) -> Option<AnyChatActionSender>
Create a chat action sender for the current channel Read more
Auto Trait Implementations§
impl !RefUnwindSafe for MatrixContextData
impl !UnwindSafe for MatrixContextData
impl Freeze for MatrixContextData
impl Send for MatrixContextData
impl Sync for MatrixContextData
impl Unpin for MatrixContextData
impl UnsafeUnpin for MatrixContextData
Blanket Implementations§
impl<T> Any for Twhere
T: Any,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ChatActionSenderBounds for T
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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> ⓘ
Converts
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> ⓘ
Converts
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