Struct tgbot::types::SendVoice

source ·
pub struct SendVoice { /* private fields */ }
Expand description

Sends a voice message.

Audio must be in an .ogg file encoded with OPUS, or in .MP3 format, or in .M4A format. Other formats may be sent as Audio or Document. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

Implementations§

source§

impl SendVoice

source

pub fn new<A, B>(chat_id: A, voice: B) -> Self
where A: Into<ChatId>, B: Into<InputFile>,

Creates a new SendVoice.

§Arguments
  • chat_id - Unique identifier of the target chat.
  • voice - Audio file to send.
source

pub fn with_business_connection_id<T>(self, value: T) -> Self
where T: Into<String>,

Sets a new business connection ID.

§Arguments
  • value - Unique identifier of the business connection.
source

pub fn with_caption<T>(self, value: T) -> Self
where T: Into<String>,

Sets a new caption.

§Arguments
  • value - Caption; 0-1024 characters.

May also be used when resending documents by file_id.

source

pub fn with_caption_entities<T>(self, value: T) -> Result<Self, TextEntityError>
where T: IntoIterator<Item = TextEntity>,

Sets a new list of caption entities.

§Arguments
  • value - The list of special entities that appear in the caption.

Caption parse mode will be set to None when this method is called.

source

pub fn with_caption_parse_mode(self, value: ParseMode) -> Self

Sets a new caption parse mode.

§Arguments
  • value - Parse mode.

Caption entities will be set to None when this method is called.

source

pub fn with_disable_notification(self, value: bool) -> Self

Sets a new value for a disable_notification flag.

§Arguments
  • value - Indicates whether to send the message silently or not; a user will receive a notification without sound.
source

pub fn with_duration(self, value: Integer) -> Self

Sets a new duration.

§Arguments
  • value - Duration in seconds.
source

pub fn with_message_thread_id(self, value: Integer) -> Self

Sets a new message thread ID.

§Arguments
  • value - Unique identifier of the target message thread; supergroups only.
source

pub fn with_protect_content(self, value: bool) -> Self

Sets a new value for a protect_content flag.

§Arguments
  • value - Indicates whether to protect the contents of the sent message from forwarding and saving.
source

pub fn with_reply_markup<T>(self, value: T) -> Result<Self, ReplyMarkupError>
where T: Into<ReplyMarkup>,

Sets a new reply markup.

§Arguments
  • value - Reply markup.
source

pub fn with_reply_parameters( self, value: ReplyParameters ) -> Result<Self, ReplyParametersError>

Sets new reply parameters.

§Arguments
  • value - Description of the message to reply to.

Trait Implementations§

source§

impl Debug for SendVoice

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Method for SendVoice

§

type Response = Message

The type representing a successful result in an API response.
source§

fn into_payload(self) -> Payload

Converts the method into a payload for an HTTP request.

Auto Trait Implementations§

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

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

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,