From fa1b793c7f45861fb23a8f734d663d358274020c Mon Sep 17 00:00:00 2001 From: Andrey Brusnik Date: Tue, 16 Jul 2024 16:53:13 +0400 Subject: [PATCH] Add `GiveawayCreated` struct --- crates/teloxide-core/src/types.rs | 2 ++ .../src/types/giveaway_created.rs | 7 ++++++ crates/teloxide-core/src/types/message.rs | 24 ++++++++++++++----- 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 crates/teloxide-core/src/types/giveaway_created.rs diff --git a/crates/teloxide-core/src/types.rs b/crates/teloxide-core/src/types.rs index 6fc26cab..a55d9dad 100644 --- a/crates/teloxide-core/src/types.rs +++ b/crates/teloxide-core/src/types.rs @@ -42,6 +42,7 @@ pub use game_high_score::*; pub use general_forum_topic_hidden::*; pub use general_forum_topic_unhidden::*; pub use giveaway::*; +pub use giveaway_created::*; pub use inaccessible_message::*; pub use inline_keyboard_button::*; pub use inline_keyboard_markup::*; @@ -176,6 +177,7 @@ mod game_high_score; mod general_forum_topic_hidden; mod general_forum_topic_unhidden; mod giveaway; +mod giveaway_created; mod inaccessible_message; mod inline_keyboard_button; mod inline_keyboard_markup; diff --git a/crates/teloxide-core/src/types/giveaway_created.rs b/crates/teloxide-core/src/types/giveaway_created.rs new file mode 100644 index 00000000..eeee1d74 --- /dev/null +++ b/crates/teloxide-core/src/types/giveaway_created.rs @@ -0,0 +1,7 @@ +use serde::{Deserialize, Serialize}; + +/// This object represents a service message about the creation of a scheduled +/// giveaway. Currently holds no information. +#[serde_with::skip_serializing_none] +#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +pub struct GiveawayCreated {} diff --git a/crates/teloxide-core/src/types/message.rs b/crates/teloxide-core/src/types/message.rs index 3c097084..ee85e240 100644 --- a/crates/teloxide-core/src/types/message.rs +++ b/crates/teloxide-core/src/types/message.rs @@ -7,12 +7,13 @@ use url::Url; use crate::types::{ Animation, Audio, BareChatId, Chat, ChatId, ChatShared, Contact, Dice, Document, ForumTopicClosed, ForumTopicCreated, ForumTopicEdited, ForumTopicReopened, Game, - GeneralForumTopicHidden, GeneralForumTopicUnhidden, Giveaway, InlineKeyboardMarkup, Invoice, - Location, MaybeInaccessibleMessage, MessageAutoDeleteTimerChanged, MessageEntity, - MessageEntityRef, MessageId, MessageOrigin, PassportData, PhotoSize, Poll, - ProximityAlertTriggered, Sticker, Story, SuccessfulPayment, TextQuote, ThreadId, True, User, - UsersShared, Venue, Video, VideoChatEnded, VideoChatParticipantsInvited, VideoChatScheduled, - VideoChatStarted, VideoNote, Voice, WebAppData, WriteAccessAllowed, + GeneralForumTopicHidden, GeneralForumTopicUnhidden, Giveaway, GiveawayCreated, + InlineKeyboardMarkup, Invoice, Location, MaybeInaccessibleMessage, + MessageAutoDeleteTimerChanged, MessageEntity, MessageEntityRef, MessageId, MessageOrigin, + PassportData, PhotoSize, Poll, ProximityAlertTriggered, Sticker, Story, SuccessfulPayment, + TextQuote, ThreadId, True, User, UsersShared, Venue, Video, VideoChatEnded, + VideoChatParticipantsInvited, VideoChatScheduled, VideoChatStarted, VideoNote, Voice, + WebAppData, WriteAccessAllowed, }; /// This object represents a message. @@ -77,6 +78,7 @@ pub enum MessageKind { GeneralForumTopicHidden(MessageGeneralForumTopicHidden), GeneralForumTopicUnhidden(MessageGeneralForumTopicUnhidden), Giveaway(MessageGiveaway), + GiveawayCreated(MessageGiveawayCreated), VideoChatScheduled(MessageVideoChatScheduled), VideoChatStarted(MessageVideoChatStarted), VideoChatEnded(MessageVideoChatEnded), @@ -603,6 +605,16 @@ pub struct MessageGiveaway { pub giveaway: Giveaway, } +#[serde_with::skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MessageGiveawayCreated { + /// Service message: a scheduled 'Giveaway' created. [More about giveaways + /// »] + /// + /// [More about giveaways »]: https://core.telegram.org/api#giveaways-amp-gifts + pub giveaway_created: GiveawayCreated, +} + #[serde_with::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MessageVideoChatScheduled {