mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Add link_preview_options
getter to Message
This commit is contained in:
parent
3d74587c93
commit
1abf1fa519
1 changed files with 21 additions and 10 deletions
|
@ -681,16 +681,16 @@ mod getters {
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use crate::types::{
|
use crate::types::{
|
||||||
self, message::MessageKind::*, Chat, ChatId, ChatMigration, MaybeInaccessibleMessage,
|
self, message::MessageKind::*, Chat, ChatId, ChatMigration, LinkPreviewOptions,
|
||||||
MediaAnimation, MediaAudio, MediaContact, MediaDocument, MediaGame, MediaKind,
|
MaybeInaccessibleMessage, MediaAnimation, MediaAudio, MediaContact, MediaDocument,
|
||||||
MediaLocation, MediaPhoto, MediaPoll, MediaSticker, MediaStory, MediaText, MediaVenue,
|
MediaGame, MediaKind, MediaLocation, MediaPhoto, MediaPoll, MediaSticker, MediaStory,
|
||||||
MediaVideo, MediaVideoNote, MediaVoice, Message, MessageChannelChatCreated,
|
MediaText, MediaVenue, MediaVideo, MediaVideoNote, MediaVoice, Message,
|
||||||
MessageChatShared, MessageCommon, MessageConnectedWebsite, MessageDeleteChatPhoto,
|
MessageChannelChatCreated, MessageChatShared, MessageCommon, MessageConnectedWebsite,
|
||||||
MessageDice, MessageEntity, MessageGroupChatCreated, MessageId, MessageInvoice,
|
MessageDeleteChatPhoto, MessageDice, MessageEntity, MessageGroupChatCreated, MessageId,
|
||||||
MessageLeftChatMember, MessageNewChatMembers, MessageNewChatPhoto, MessageNewChatTitle,
|
MessageInvoice, MessageLeftChatMember, MessageNewChatMembers, MessageNewChatPhoto,
|
||||||
MessageOrigin, MessagePassportData, MessagePinned, MessageProximityAlertTriggered,
|
MessageNewChatTitle, MessageOrigin, MessagePassportData, MessagePinned,
|
||||||
MessageSuccessfulPayment, MessageSupergroupChatCreated, MessageUsersShared,
|
MessageProximityAlertTriggered, MessageSuccessfulPayment, MessageSupergroupChatCreated,
|
||||||
MessageVideoChatParticipantsInvited, PhotoSize, TextQuote, User,
|
MessageUsersShared, MessageVideoChatParticipantsInvited, PhotoSize, TextQuote, User,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
@ -870,6 +870,17 @@ mod getters {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn link_preview_options(&self) -> Option<&LinkPreviewOptions> {
|
||||||
|
match &self.kind {
|
||||||
|
Common(MessageCommon {
|
||||||
|
media_kind: MediaKind::Text(MediaText { link_preview_options, .. }),
|
||||||
|
..
|
||||||
|
}) => link_preview_options.as_ref(),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns message entities that represent text formatting.
|
/// Returns message entities that represent text formatting.
|
||||||
///
|
///
|
||||||
/// **Note:** you probably want to use [`parse_caption_entities`]
|
/// **Note:** you probably want to use [`parse_caption_entities`]
|
||||||
|
|
Loading…
Reference in a new issue