Struct Answer

Source
pub struct Answer<'a> { /* private fields */ }
Expand description

A callback query answer builder.

It will be executed once .await-ed. Modifying it after polling it once will have no effect.

Implementations§

Source§

impl<'a> Answer<'a>

Source

pub fn text<T: Into<String>>(self, text: T) -> Self

Configure the answer’s text.

The text will be displayed as a toast message (small popup which does not interrupt the user and fades on its own after a short period of time).

Source

pub fn cache_time(self, time: Duration) -> Self

For how long should the answer be considered valid. It will be cached by the client for the given duration, so subsequent callback queries with the same data will not reach the bot.

Source

pub fn alert<T: Into<String>>(self, text: T) -> Self

Configure the answer’s text.

The text will be displayed as an alert (popup modal window with the text, which the user needs to close before performing other actions).

Source

pub async fn send(self) -> Result<(), InvocationError>

Send the answer back to Telegram, and then relayed to the user who pressed the inline button.

Source

pub async fn edit<M: Into<InputMessage>>( self, new_message: M, ) -> Result<(), InvocationError>

Self::send the answer, and also edit the message that contained the button.

Source

pub async fn respond<M: Into<InputMessage>>( self, message: M, ) -> Result<Message, InvocationError>

Self::send the answer, and also respond in the chat where the button was clicked.

Source

pub async fn reply<M: Into<InputMessage>>( self, message: M, ) -> Result<Message, InvocationError>

Self::send the answer, and also reply to the message that contained the button.

Auto Trait Implementations§

§

impl<'a> Freeze for Answer<'a>

§

impl<'a> !RefUnwindSafe for Answer<'a>

§

impl<'a> Send for Answer<'a>

§

impl<'a> Sync for Answer<'a>

§

impl<'a> Unpin for Answer<'a>

§

impl<'a> !UnwindSafe for Answer<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.