Add GiveawayCompleted struct

This commit is contained in:
Andrey Brusnik 2024-07-16 17:33:48 +04:00
parent 9d803693fb
commit d9587ea562
No known key found for this signature in database
GPG key ID: D33232F28CFF442C
3 changed files with 38 additions and 7 deletions

View file

@ -42,6 +42,7 @@ pub use game_high_score::*;
pub use general_forum_topic_hidden::*; pub use general_forum_topic_hidden::*;
pub use general_forum_topic_unhidden::*; pub use general_forum_topic_unhidden::*;
pub use giveaway::*; pub use giveaway::*;
pub use giveaway_completed::*;
pub use giveaway_created::*; pub use giveaway_created::*;
pub use giveaway_winners::*; pub use giveaway_winners::*;
pub use inaccessible_message::*; pub use inaccessible_message::*;
@ -178,6 +179,7 @@ mod game_high_score;
mod general_forum_topic_hidden; mod general_forum_topic_hidden;
mod general_forum_topic_unhidden; mod general_forum_topic_unhidden;
mod giveaway; mod giveaway;
mod giveaway_completed;
mod giveaway_created; mod giveaway_created;
mod giveaway_winners; mod giveaway_winners;
mod inaccessible_message; mod inaccessible_message;

View file

@ -0,0 +1,18 @@
use serde::{Deserialize, Serialize};
use crate::types::Message;
/// This object represents a service message about the completion of a giveaway
/// without public winners.
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GiveawayCompleted {
/// Number of winners in the giveaway
pub winner_count: u32,
/// Number of undistributed prizes
pub unclaimed_prize_count: Option<u32>,
/// Message with the giveaway that was completed, if it wasn't deleted
pub giveaway_message: Option<Box<Message>>,
}

View file

@ -7,13 +7,13 @@ use url::Url;
use crate::types::{ use crate::types::{
Animation, Audio, BareChatId, Chat, ChatId, ChatShared, Contact, Dice, Document, Animation, Audio, BareChatId, Chat, ChatId, ChatShared, Contact, Dice, Document,
ForumTopicClosed, ForumTopicCreated, ForumTopicEdited, ForumTopicReopened, Game, ForumTopicClosed, ForumTopicCreated, ForumTopicEdited, ForumTopicReopened, Game,
GeneralForumTopicHidden, GeneralForumTopicUnhidden, Giveaway, GiveawayCreated, GiveawayWinners, GeneralForumTopicHidden, GeneralForumTopicUnhidden, Giveaway, GiveawayCompleted,
InlineKeyboardMarkup, Invoice, Location, MaybeInaccessibleMessage, GiveawayCreated, GiveawayWinners, InlineKeyboardMarkup, Invoice, Location,
MessageAutoDeleteTimerChanged, MessageEntity, MessageEntityRef, MessageId, MessageOrigin, MaybeInaccessibleMessage, MessageAutoDeleteTimerChanged, MessageEntity, MessageEntityRef,
PassportData, PhotoSize, Poll, ProximityAlertTriggered, Sticker, Story, SuccessfulPayment, MessageId, MessageOrigin, PassportData, PhotoSize, Poll, ProximityAlertTriggered, Sticker,
TextQuote, ThreadId, True, User, UsersShared, Venue, Video, VideoChatEnded, Story, SuccessfulPayment, TextQuote, ThreadId, True, User, UsersShared, Venue, Video,
VideoChatParticipantsInvited, VideoChatScheduled, VideoChatStarted, VideoNote, Voice, VideoChatEnded, VideoChatParticipantsInvited, VideoChatScheduled, VideoChatStarted, VideoNote,
WebAppData, WriteAccessAllowed, Voice, WebAppData, WriteAccessAllowed,
}; };
/// This object represents a message. /// This object represents a message.
@ -78,6 +78,7 @@ pub enum MessageKind {
GeneralForumTopicHidden(MessageGeneralForumTopicHidden), GeneralForumTopicHidden(MessageGeneralForumTopicHidden),
GeneralForumTopicUnhidden(MessageGeneralForumTopicUnhidden), GeneralForumTopicUnhidden(MessageGeneralForumTopicUnhidden),
Giveaway(MessageGiveaway), Giveaway(MessageGiveaway),
GiveawayCompleted(MessageGiveawayCompleted),
GiveawayCreated(MessageGiveawayCreated), GiveawayCreated(MessageGiveawayCreated),
GiveawayWinners(MessageGiveawayWinners), GiveawayWinners(MessageGiveawayWinners),
VideoChatScheduled(MessageVideoChatScheduled), VideoChatScheduled(MessageVideoChatScheduled),
@ -606,6 +607,16 @@ pub struct MessageGiveaway {
pub giveaway: Giveaway, pub giveaway: Giveaway,
} }
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MessageGiveawayCompleted {
/// Service message: a 'Giveaway' completed. [More about giveaways
/// »]
///
/// [More about giveaways »]: https://core.telegram.org/api#giveaways-amp-gifts
pub giveaway_completed: GiveawayCompleted,
}
#[serde_with::skip_serializing_none] #[serde_with::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MessageGiveawayCreated { pub struct MessageGiveawayCreated {