Skip to main content

CopyMessageBuilder

Struct CopyMessageBuilder 

Source
pub struct CopyMessageBuilder<'a> {
    pub chat_id: i64,
    pub message_thread_id: Option<i64>,
    pub from_chat_id: i64,
    pub message_id: i64,
    pub caption: Option<String>,
    pub parse_mode: Option<String>,
    pub caption_entities: Option<Vec<MessageEntity>>,
    pub show_caption_above_media: Option<bool>,
    pub disable_notification: Option<bool>,
    pub protect_content: Option<bool>,
    pub reply_parameters: Option<ReplyParameters>,
    pub reply_markup: Option<InlineKeyboardMarkup>,
    /* private fields */
}

Fields§

§chat_id: i64

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

§message_thread_id: Option<i64>

Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

§from_chat_id: i64

Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)

§message_id: i64

Message identifier in the chat specified in from_chat_id

§caption: Option<String>

New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept

§parse_mode: Option<String>

Mode for parsing entities in the new caption. See formatting options for more details.

§caption_entities: Option<Vec<MessageEntity>>

A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode

§show_caption_above_media: Option<bool>

Pass True, if the caption must be shown above the message media. Ignored if a new caption isn’t specified.

§disable_notification: Option<bool>

Sends the message silently. Users will receive a notification with no sound.

§protect_content: Option<bool>

Protects the contents of the sent message from forwarding and saving

§reply_parameters: Option<ReplyParameters>

Description of the message to reply to

§reply_markup: Option<InlineKeyboardMarkup>

Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user

Implementations§

Source§

impl<'a> CopyMessageBuilder<'a>

Source

pub fn new( bot: &'a Bot, chat_id: i64, from_chat_id: i64, message_id: i64, ) -> Self

Source

pub fn chat_id(self, chat_id: i64) -> Self

Source

pub fn message_thread_id(self, message_thread_id: i64) -> Self

Source

pub fn from_chat_id(self, from_chat_id: i64) -> Self

Source

pub fn message_id(self, message_id: i64) -> Self

Source

pub fn caption(self, caption: String) -> Self

Source

pub fn parse_mode(self, parse_mode: String) -> Self

Source

pub fn caption_entities(self, caption_entities: Vec<MessageEntity>) -> Self

Source

pub fn show_caption_above_media(self, show_caption_above_media: bool) -> Self

Source

pub fn disable_notification(self, disable_notification: bool) -> Self

Source

pub fn protect_content(self, protect_content: bool) -> Self

Source

pub fn reply_parameters(self, reply_parameters: ReplyParameters) -> Self

Source

pub fn reply_markup(self, reply_markup: InlineKeyboardMarkup) -> Self

Source

pub async fn send(self) -> Result<MessageId>

Examples found in repository?
examples/echobot.rs (line 85)
76async fn echo(bot: Bot, ctx: Context) -> Result<GroupIteration> {
77    // Command Handler recieves message updates which have chat as a compulsory field.
78    // Hence we can unwrap effective chat without checking if it is none.
79    let chat = ctx.effective_chat.unwrap();
80    // Same logic as chat applies on unwrapping effective message here.
81    let msg = ctx.effective_message.unwrap();
82    // Every api method creates a builder which contains various parameters of that respective method.
83    bot.copy_message(chat.id, chat.id, msg.message_id)
84        // You must use this send() method in order to send the request to the API
85        .send()
86        .await?;
87
88    // GroupIteration::EndGroups will end iteration of groups for an update.
89    // This means that rest of the pending groups and their handlers won't be checked
90    // for this particular update.
91    Ok(GroupIteration::EndGroups)
92}

Trait Implementations§

Source§

impl<'a> Serialize for CopyMessageBuilder<'a>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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