MessageContent

Enum MessageContent 

Source
pub enum MessageContent {
Show 35 variants Text { content: String, entities: Vec<MessageEntity>, }, Audio { content: Audio, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Document { content: Document, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Animation { content: Animation, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Video { content: Video, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, media_group_id: Option<String>, }, Voice { content: Voice, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, }, Photo { content: Vec<PhotoSize>, caption: Option<String>, caption_entities: Option<Vec<MessageEntity>>, media_group_id: Option<String>, }, Game { content: Game, }, Sticker { content: Sticker, }, VideoNote { content: VideoNote, }, Contact { content: Contact, }, Location { content: Location, }, Venue { content: Venue, }, Poll { content: Poll, }, Dice { content: Dice, }, NewChatMembers { content: Vec<User>, }, LeftChatMember { content: User, }, NewChatTitle { content: String, }, NewChatPhoto { content: Vec<PhotoSize>, }, MessageAutoDeleteTimerChanged { content: MessageAutoDeleteTimerChanged, }, MigrateToChatID { content: i64, }, MigrateFromChatID { content: i64, }, PinnedMessage { content: Box<Message>, }, Invoice { content: Invoice, }, SuccessfulPayment { content: SuccessfulPayment, }, ProximityAlertTriggered { content: ProximityAlertTriggered, }, VoiceChatScheduled { content: VoiceChatScheduled, }, VoiceChatStarted { content: VoiceChatStarted, }, VoiceChatEnded { content: VoiceChatEnded, }, VoiceChatParticipantsInvited { content: VoiceChatParticipantsInvited, }, DeleteChatPhoto, GroupChatCreated, SupergroupChatCreated, ChannelChatCreated, Unknown,
}
Expand description

The content of a Message

Variants§

§

Text

Fields

§content: String

The actual UTF-8 text of the message, 0-4096 characters

§entities: Vec<MessageEntity>

Special entities like usernames, URLs, bot commands, etc. that appear in the text

§

Audio

Fields

§content: Audio

Information about the audio file

§caption: Option<String>

The caption, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

Special entities like usernames, URLs, bot commands, etc. that appear in the caption

§

Document

Fields

§content: Document

Information about the file

§caption: Option<String>

The caption, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

Special entities like usernames, URLs, bot commands, etc. that appear in the caption

§

Animation

Fields

§content: Animation

Information about the animation.

§caption: Option<String>

The caption, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

Special entities like usernames, URLs, bot commands, etc. that appear in the caption

§

Video

Fields

§content: Video

Information about the video

§caption: Option<String>

The caption, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

Special entities like usernames, URLs, bot commands, etc. that appear in the caption

§media_group_id: Option<String>

The unique identifier of a media message group this message belongs to

§

Voice

Fields

§content: Voice

Information about the voice file

§caption: Option<String>

The caption, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

Special entities like usernames, URLs, bot commands, etc. that appear in the caption

§

Photo

Fields

§content: Vec<PhotoSize>

Available sizes of the photo

§caption: Option<String>

The caption, 0-1024 characters

§caption_entities: Option<Vec<MessageEntity>>

Special entities like usernames, URLs, bot commands, etc. that appear in the caption

§media_group_id: Option<String>

The unique identifier of a media message group this message belongs to

§

Game

Fields

§content: Game

Information about the game

§

Sticker

Fields

§content: Sticker

Information about the sticker

§

VideoNote

Fields

§content: VideoNote

Information about the video message

§

Contact

Fields

§content: Contact

Information about the shared contact

§

Location

Fields

§content: Location

Information about the shared location

§

Venue

Fields

§content: Venue

Information about the venue

§

Poll

Fields

§content: Poll

Information about the native poll

§

Dice

Fields

§content: Dice

a dice with a random value from 1 to 6

§

NewChatMembers

Fields

§content: Vec<User>

New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)

§

LeftChatMember

Fields

§content: User

A member was removed from the group, information about them (this member may be the bot itself)

§

NewChatTitle

Fields

§content: String

A chat title was changed to this value

§

NewChatPhoto

Fields

§content: Vec<PhotoSize>

A chat photo was change to this value

§

MessageAutoDeleteTimerChanged

Fields

§content: MessageAutoDeleteTimerChanged

Service message: auto-delete timer settings changed in the chat

§

MigrateToChatID

Fields

§content: i64

The group has been migrated to a supergroup with the specified identifier.

§

MigrateFromChatID

Fields

§content: i64

The supergroup has been migrated from a group with the specified identifier.

§

PinnedMessage

Fields

§content: Box<Message>

Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.

§

Invoice

Fields

§content: Invoice

Message is an invoice for a payment, information about the invoice.

§

SuccessfulPayment

Fields

§content: SuccessfulPayment

Message is a service message about a successful payment, information about the payment.

§

ProximityAlertTriggered

Fields

§content: ProximityAlertTriggered

Service message. A user in the chat triggered another user’s proximity alert while sharing Live Location.

§

VoiceChatScheduled

Fields

§content: VoiceChatScheduled

Service message: voice chat scheduled

§

VoiceChatStarted

Fields

§content: VoiceChatStarted

Service message: voice chat started

§

VoiceChatEnded

Fields

§content: VoiceChatEnded

Service message: voice chat ended

§

VoiceChatParticipantsInvited

Fields

§content: VoiceChatParticipantsInvited

Service message: new participants invited to a voice chat

§

DeleteChatPhoto

Service message: the chat photo was deleted

§

GroupChatCreated

Service message: the group has been created

§

SupergroupChatCreated

Service message: the supergroup has been created. This field can‘t be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.

§

ChannelChatCreated

Service message: the channel has been created. This field can‘t be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to the very first message in a channel.

§

Unknown

Received a message with an unknown content

Trait Implementations§

Source§

impl Clone for MessageContent

Source§

fn clone(&self) -> MessageContent

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MessageContent

Source§

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

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

impl PartialEq for MessageContent

Source§

fn eq(&self, other: &MessageContent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MessageContent

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> CloneAny for T
where T: Any + Clone,

Source§

fn clone_any(&self) -> Box<dyn CloneAny>

Source§

fn clone_any_send(&self) -> Box<dyn CloneAny + Send>
where T: Send,

Source§

fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync>
where T: Sync,

Source§

fn clone_any_send_sync(&self) -> Box<dyn CloneAny + Send + Sync>
where T: Send + Sync,

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

impl<T> DebugAny for T
where T: Any + Debug,

Source§

impl<T> UnsafeAny for T
where T: Any,