mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Add the field story to the struct Message
This commit is contained in:
parent
617197a1c7
commit
3016cbaf68
4 changed files with 39 additions and 11 deletions
|
@ -105,6 +105,7 @@ pub use shipping_option::*;
|
|||
pub use shipping_query::*;
|
||||
pub use sticker::*;
|
||||
pub use sticker_set::*;
|
||||
pub use story::*;
|
||||
pub use successful_payment::*;
|
||||
pub use switch_inline_query_chosen_chat::*;
|
||||
pub use target_message::*;
|
||||
|
@ -206,6 +207,7 @@ mod shipping_option;
|
|||
mod shipping_query;
|
||||
mod sticker;
|
||||
mod sticker_set;
|
||||
mod story;
|
||||
mod successful_payment;
|
||||
mod switch_inline_query_chosen_chat;
|
||||
mod target_message;
|
||||
|
|
|
@ -9,9 +9,9 @@ use crate::types::{
|
|||
ForumTopicClosed, ForumTopicCreated, ForumTopicEdited, ForumTopicReopened, Game,
|
||||
GeneralForumTopicHidden, GeneralForumTopicUnhidden, InlineKeyboardMarkup, Invoice, Location,
|
||||
MessageAutoDeleteTimerChanged, MessageEntity, MessageEntityRef, MessageId, PassportData,
|
||||
PhotoSize, Poll, ProximityAlertTriggered, Sticker, SuccessfulPayment, ThreadId, True, User,
|
||||
UserShared, Venue, Video, VideoChatEnded, VideoChatParticipantsInvited, VideoChatScheduled,
|
||||
VideoChatStarted, VideoNote, Voice, WebAppData, WriteAccessAllowed,
|
||||
PhotoSize, Poll, ProximityAlertTriggered, Sticker, Story, SuccessfulPayment, ThreadId, True,
|
||||
User, UserShared, Venue, Video, VideoChatEnded, VideoChatParticipantsInvited,
|
||||
VideoChatScheduled, VideoChatStarted, VideoNote, Voice, WebAppData, WriteAccessAllowed,
|
||||
};
|
||||
|
||||
/// This object represents a message.
|
||||
|
@ -366,6 +366,7 @@ pub enum MediaKind {
|
|||
Photo(MediaPhoto),
|
||||
Poll(MediaPoll),
|
||||
Sticker(MediaSticker),
|
||||
Story(MediaStory),
|
||||
Text(MediaText),
|
||||
Video(MediaVideo),
|
||||
VideoNote(MediaVideoNote),
|
||||
|
@ -494,6 +495,13 @@ pub struct MediaSticker {
|
|||
pub sticker: Sticker,
|
||||
}
|
||||
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct MediaStory {
|
||||
/// Message is a forwarded story
|
||||
pub story: Story,
|
||||
}
|
||||
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct MediaText {
|
||||
|
@ -668,14 +676,14 @@ mod getters {
|
|||
use crate::types::{
|
||||
self, message::MessageKind::*, Chat, ChatId, ChatMigration, Forward, ForwardedFrom,
|
||||
MediaAnimation, MediaAudio, MediaContact, MediaDocument, MediaGame, MediaKind,
|
||||
MediaLocation, MediaPhoto, MediaPoll, MediaSticker, MediaText, MediaVenue, MediaVideo,
|
||||
MediaVideoNote, MediaVoice, Message, MessageChannelChatCreated, MessageChatShared,
|
||||
MessageCommon, MessageConnectedWebsite, MessageDeleteChatPhoto, MessageDice, MessageEntity,
|
||||
MessageGroupChatCreated, MessageId, MessageInvoice, MessageLeftChatMember,
|
||||
MessageNewChatMembers, MessageNewChatPhoto, MessageNewChatTitle, MessagePassportData,
|
||||
MessagePinned, MessageProximityAlertTriggered, MessageSuccessfulPayment,
|
||||
MessageSupergroupChatCreated, MessageUserShared, MessageVideoChatParticipantsInvited,
|
||||
PhotoSize, User,
|
||||
MediaLocation, MediaPhoto, MediaPoll, MediaSticker, MediaStory, MediaText, MediaVenue,
|
||||
MediaVideo, MediaVideoNote, MediaVoice, Message, MessageChannelChatCreated,
|
||||
MessageChatShared, MessageCommon, MessageConnectedWebsite, MessageDeleteChatPhoto,
|
||||
MessageDice, MessageEntity, MessageGroupChatCreated, MessageId, MessageInvoice,
|
||||
MessageLeftChatMember, MessageNewChatMembers, MessageNewChatPhoto, MessageNewChatTitle,
|
||||
MessagePassportData, MessagePinned, MessageProximityAlertTriggered,
|
||||
MessageSuccessfulPayment, MessageSupergroupChatCreated, MessageUserShared,
|
||||
MessageVideoChatParticipantsInvited, PhotoSize, User,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
@ -899,6 +907,7 @@ mod getters {
|
|||
| MediaKind::Location(_)
|
||||
| MediaKind::Poll(_)
|
||||
| MediaKind::Sticker(_)
|
||||
| MediaKind::Story(_)
|
||||
| MediaKind::Text(_)
|
||||
| MediaKind::VideoNote(_)
|
||||
| MediaKind::Voice(_)
|
||||
|
@ -973,6 +982,17 @@ mod getters {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn story(&self) -> Option<&types::Story> {
|
||||
match &self.kind {
|
||||
Common(MessageCommon {
|
||||
media_kind: MediaKind::Story(MediaStory { story, .. }),
|
||||
..
|
||||
}) => Some(story),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn video(&self) -> Option<&types::Video> {
|
||||
match &self.kind {
|
||||
|
|
5
crates/teloxide-core/src/types/story.rs
Normal file
5
crates/teloxide-core/src/types/story.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// TBA 6.8: currently it holds no information
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Story;
|
|
@ -83,6 +83,7 @@ define_message_ext! {
|
|||
(filter_photo, Message::photo),
|
||||
(filter_poll, Message::poll),
|
||||
(filter_sticker, Message::sticker),
|
||||
(filter_story, Message::story),
|
||||
(filter_text, Message::text),
|
||||
(filter_video, Message::video),
|
||||
(filter_video_note, Message::video_note),
|
||||
|
|
Loading…
Reference in a new issue