Skip to main content

CopyOptions

Struct CopyOptions 

Source
pub struct CopyOptions {
Show 18 fields pub silent: bool, pub background: bool, pub drop_captions: bool, pub noforwards: bool, pub reply_to: Option<i32>, pub topic_id: Option<i32>, pub schedule_date: Option<i32>, pub schedule_repeat_period: Option<i32>, pub send_as: Option<PeerRef>, pub effect: Option<i64>, pub video_timestamp: Option<i32>, pub allow_paid_stars: Option<i64>, pub allow_paid_floodskip: bool, pub quick_reply_shortcut: Option<InputQuickReplyShortcut>, pub suggested_post: Option<SuggestedPost>, pub caption: Option<String>, pub caption_entities: Option<Vec<MessageEntity>>, pub reply_markup: Option<ReplyMarkup>,
}
Expand description

Options for copying messages (forward without the “Forwarded from” attribution).

Used by crate::Client::copy_messages and IncomingMessage::copy. This is the same underlying messages.forwardMessages call as ForwardOptions, with drop_author always forced to true - which is exactly what Telegram’s own “copy” feature does under the hood.

Fields§

§silent: bool

Send silently (no notification for recipient).

§background: bool

Send as a background message (doesn’t bump the chat to the top).

§drop_captions: bool

Remove captions from copied media. Honored on both the cheap forward path (via drop_media_captions) and the fetch-and-resend override path - the latter only when caption is left None; an explicit caption always wins over this flag.

§noforwards: bool

Prevent recipients from forwarding the message further.

§reply_to: Option<i32>

Reply to an existing message in the destination chat.

§topic_id: Option<i32>

Copy into this forum topic thread (the top_msg_id of the topic, see crate::Client::get_forum_topics).

§schedule_date: Option<i32>

Schedule the copy for this Unix timestamp (seconds).

§schedule_repeat_period: Option<i32>

Repeat the scheduled copy every N seconds. Only meaningful with schedule_date set.

§send_as: Option<PeerRef>

Send as a different identity you’re allowed to send as (e.g. an anonymous admin identity, or a linked channel) instead of yourself.

§effect: Option<i64>

Attach a message effect (Premium sticker/emoji effect) by its ID.

§video_timestamp: Option<i32>

Start the copied video’s preview at this timestamp (seconds).

§allow_paid_stars: Option<i64>

Stars you’re willing to pay if the destination charges for messages.

§allow_paid_floodskip: bool

Bypass paid-messages flood limits by paying Stars.

§quick_reply_shortcut: Option<InputQuickReplyShortcut>

Associate the copy with a business-account quick reply shortcut.

§suggested_post: Option<SuggestedPost>

Send as a channel “suggested post” instead of posting directly.

§caption: Option<String>

Replace the copy’s text/caption instead of keeping the original.

Setting this (or CopyOptions::reply_markup) routes the copy through crate::Client::copy_message’s fetch-and-resend path instead of the cheap forward_messages path: raw MTProto’s messages.forwardMessages has no field to override text or caption, only drop_media_captions (keep or strip, nothing else), so an override can only be done by fetching the source message and sending its media as a brand-new message - the same way Telegram’s own Bot API implements copyMessage under the hood.

When left None, the source message’s own text/caption is kept - and its formatting entities (bold, italic, links, code, spoilers, …) are carried over with it. Set CopyOptions::caption_entities alongside this field to give a new caption its own formatting.

§caption_entities: Option<Vec<MessageEntity>>

Formatting entities for CopyOptions::caption. Ignored unless caption is also set - when caption is None, the source message’s own entities are used instead, so there’s nothing to override here.

§reply_markup: Option<ReplyMarkup>

Attach a reply markup to the copy instead of sending it bare.

Unlike Telegram’s Bot API, this never falls back to the source message’s own reply markup when left None - buttons are commonly tied to the original bot’s callback handlers, so silently carrying them over to a copy sent by a different client would produce dead buttons. Pass the source’s markup explicitly if you want to keep it.

Also routes through the fetch-and-resend path; see CopyOptions::caption.

Trait Implementations§

Source§

impl Clone for CopyOptions

Source§

fn clone(&self) -> CopyOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for CopyOptions

Source§

fn default() -> CopyOptions

Returns the “default value” for a type. Read more
Source§

impl From<CopyOptions> for ForwardOptions

Source§

fn from(o: CopyOptions) -> Self

Converts to this type from the input type.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
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