[−][src]Struct vk_bot::context::Context
Stores information necessary for handlers, allows to send the resulting message.
Methods
impl<'api> Context<'api>
[src]
pub fn new(event: Event, req: &CallbackAPIRequest, api: &'api APIClient) -> Self
[src]
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) -> &APIClient
[src]
Returns the global rvk::APIClient
which is used in this bot.
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
impl<'api> !RefUnwindSafe for Context<'api>
impl<'api> Send for Context<'api>
impl<'api> Sync for Context<'api>
impl<'api> Unpin for Context<'api>
impl<'api> !UnwindSafe for Context<'api>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoCollection<T> 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, U> TryFrom<U> 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, U> TryInto<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,