[−][src]Struct vk_bot::context::Context
Stores information necessary for handlers, allows to send the resulting message.
Methods
impl Context
[src]
pub fn new(
event: Event,
req: &CallbackAPIRequest,
api: Arc<Mutex<APIClient>>
) -> Self
[src]
event: Event,
req: &CallbackAPIRequest,
api: Arc<Mutex<APIClient>>
) -> Self
Creates a new Context
.
Panics
- no user_id on object (only
Event::MessageAllow
) - no from_id on object (
Event::MessageTypingState
) - no peer_id on object (other events)
pub fn group_id(&self) -> i32
[src]
Returns the group ID.
pub fn event(&self) -> Event
[src]
Returns the original Callback API event type that caused this handler to run.
pub fn object(&self) -> &Object
[src]
Returns the object associated with the event (given by Callback API).
pub fn api(&self) -> Arc<Mutex<APIClient>>
[src]
Returns an rvk::APIClient
, wrapped into
Arc
<
Mutex
<...>>
.
pub fn response(&mut self) -> &mut Response
[src]
Returns the current pending response object (mutable).
pub fn send(&self) -> Result<(), Error>
[src]
Sends the response.
This does not erase the response object. You can send multiple messages.
This method currently blocks until the rvk::APIClient
is available,
so only one message is being sent at a given time. This behavior may
change.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> IntoCollection for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, I> AsResult for T where
I: Input,
I: Input,