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 shipping_query::*;
|
||||||
pub use sticker::*;
|
pub use sticker::*;
|
||||||
pub use sticker_set::*;
|
pub use sticker_set::*;
|
||||||
|
pub use story::*;
|
||||||
pub use successful_payment::*;
|
pub use successful_payment::*;
|
||||||
pub use switch_inline_query_chosen_chat::*;
|
pub use switch_inline_query_chosen_chat::*;
|
||||||
pub use target_message::*;
|
pub use target_message::*;
|
||||||
|
@ -206,6 +207,7 @@ mod shipping_option;
|
||||||
mod shipping_query;
|
mod shipping_query;
|
||||||
mod sticker;
|
mod sticker;
|
||||||
mod sticker_set;
|
mod sticker_set;
|
||||||
|
mod story;
|
||||||
mod successful_payment;
|
mod successful_payment;
|
||||||
mod switch_inline_query_chosen_chat;
|
mod switch_inline_query_chosen_chat;
|
||||||
mod target_message;
|
mod target_message;
|
||||||
|
|
|
@ -9,9 +9,9 @@ use crate::types::{
|
||||||
ForumTopicClosed, ForumTopicCreated, ForumTopicEdited, ForumTopicReopened, Game,
|
ForumTopicClosed, ForumTopicCreated, ForumTopicEdited, ForumTopicReopened, Game,
|
||||||
GeneralForumTopicHidden, GeneralForumTopicUnhidden, InlineKeyboardMarkup, Invoice, Location,
|
GeneralForumTopicHidden, GeneralForumTopicUnhidden, InlineKeyboardMarkup, Invoice, Location,
|
||||||
MessageAutoDeleteTimerChanged, MessageEntity, MessageEntityRef, MessageId, PassportData,
|
MessageAutoDeleteTimerChanged, MessageEntity, MessageEntityRef, MessageId, PassportData,
|
||||||
PhotoSize, Poll, ProximityAlertTriggered, Sticker, SuccessfulPayment, ThreadId, True, User,
|
PhotoSize, Poll, ProximityAlertTriggered, Sticker, Story, SuccessfulPayment, ThreadId, True,
|
||||||
UserShared, Venue, Video, VideoChatEnded, VideoChatParticipantsInvited, VideoChatScheduled,
|
User, UserShared, Venue, Video, VideoChatEnded, VideoChatParticipantsInvited,
|
||||||
VideoChatStarted, VideoNote, Voice, WebAppData, WriteAccessAllowed,
|
VideoChatScheduled, VideoChatStarted, VideoNote, Voice, WebAppData, WriteAccessAllowed,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// This object represents a message.
|
/// This object represents a message.
|
||||||
|
@ -366,6 +366,7 @@ pub enum MediaKind {
|
||||||
Photo(MediaPhoto),
|
Photo(MediaPhoto),
|
||||||
Poll(MediaPoll),
|
Poll(MediaPoll),
|
||||||
Sticker(MediaSticker),
|
Sticker(MediaSticker),
|
||||||
|
Story(MediaStory),
|
||||||
Text(MediaText),
|
Text(MediaText),
|
||||||
Video(MediaVideo),
|
Video(MediaVideo),
|
||||||
VideoNote(MediaVideoNote),
|
VideoNote(MediaVideoNote),
|
||||||
|
@ -494,6 +495,13 @@ pub struct MediaSticker {
|
||||||
pub sticker: Sticker,
|
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]
|
#[serde_with_macros::skip_serializing_none]
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct MediaText {
|
pub struct MediaText {
|
||||||
|
@ -668,14 +676,14 @@ mod getters {
|
||||||
use crate::types::{
|
use crate::types::{
|
||||||
self, message::MessageKind::*, Chat, ChatId, ChatMigration, Forward, ForwardedFrom,
|
self, message::MessageKind::*, Chat, ChatId, ChatMigration, Forward, ForwardedFrom,
|
||||||
MediaAnimation, MediaAudio, MediaContact, MediaDocument, MediaGame, MediaKind,
|
MediaAnimation, MediaAudio, MediaContact, MediaDocument, MediaGame, MediaKind,
|
||||||
MediaLocation, MediaPhoto, MediaPoll, MediaSticker, MediaText, MediaVenue, MediaVideo,
|
MediaLocation, MediaPhoto, MediaPoll, MediaSticker, MediaStory, MediaText, MediaVenue,
|
||||||
MediaVideoNote, MediaVoice, Message, MessageChannelChatCreated, MessageChatShared,
|
MediaVideo, MediaVideoNote, MediaVoice, Message, MessageChannelChatCreated,
|
||||||
MessageCommon, MessageConnectedWebsite, MessageDeleteChatPhoto, MessageDice, MessageEntity,
|
MessageChatShared, MessageCommon, MessageConnectedWebsite, MessageDeleteChatPhoto,
|
||||||
MessageGroupChatCreated, MessageId, MessageInvoice, MessageLeftChatMember,
|
MessageDice, MessageEntity, MessageGroupChatCreated, MessageId, MessageInvoice,
|
||||||
MessageNewChatMembers, MessageNewChatPhoto, MessageNewChatTitle, MessagePassportData,
|
MessageLeftChatMember, MessageNewChatMembers, MessageNewChatPhoto, MessageNewChatTitle,
|
||||||
MessagePinned, MessageProximityAlertTriggered, MessageSuccessfulPayment,
|
MessagePassportData, MessagePinned, MessageProximityAlertTriggered,
|
||||||
MessageSupergroupChatCreated, MessageUserShared, MessageVideoChatParticipantsInvited,
|
MessageSuccessfulPayment, MessageSupergroupChatCreated, MessageUserShared,
|
||||||
PhotoSize, User,
|
MessageVideoChatParticipantsInvited, PhotoSize, User,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
@ -899,6 +907,7 @@ mod getters {
|
||||||
| MediaKind::Location(_)
|
| MediaKind::Location(_)
|
||||||
| MediaKind::Poll(_)
|
| MediaKind::Poll(_)
|
||||||
| MediaKind::Sticker(_)
|
| MediaKind::Sticker(_)
|
||||||
|
| MediaKind::Story(_)
|
||||||
| MediaKind::Text(_)
|
| MediaKind::Text(_)
|
||||||
| MediaKind::VideoNote(_)
|
| MediaKind::VideoNote(_)
|
||||||
| MediaKind::Voice(_)
|
| 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]
|
#[must_use]
|
||||||
pub fn video(&self) -> Option<&types::Video> {
|
pub fn video(&self) -> Option<&types::Video> {
|
||||||
match &self.kind {
|
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_photo, Message::photo),
|
||||||
(filter_poll, Message::poll),
|
(filter_poll, Message::poll),
|
||||||
(filter_sticker, Message::sticker),
|
(filter_sticker, Message::sticker),
|
||||||
|
(filter_story, Message::story),
|
||||||
(filter_text, Message::text),
|
(filter_text, Message::text),
|
||||||
(filter_video, Message::video),
|
(filter_video, Message::video),
|
||||||
(filter_video_note, Message::video_note),
|
(filter_video_note, Message::video_note),
|
||||||
|
|
Loading…
Reference in a new issue