diff --git a/src/objects.rs b/src/objects.rs index 65cdef7..9be947c 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -897,6 +897,52 @@ pub struct MessageEntity { pub custom_emoji_id: Option, } +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +#[serde(tag = "type", rename_all = "snake_case")] +pub enum MessageOrigin { + User(MessageOriginUser), + HiddenUser(MessageOriginHiddenUser), + Chat(MessageOriginChat), + Channel(MessageOriginChannel), +} + +#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq)] +pub struct MessageOriginUser { + pub date: u64, + pub sender_user: User, +} + +#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq)] +pub struct MessageOriginHiddenUser { + pub date: u64, + #[builder(setter(into))] + pub sender_user_name: String, +} + +#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq)] +pub struct MessageOriginChat { + pub date: u64, + + pub sender_chat: Chat, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub author_signature: Option, +} + +#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq)] +pub struct MessageOriginChannel { + pub date: u64, + + pub chat: Chat, + + pub message_id: i32, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub author_signature: Option, +} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] pub struct PhotoSize { #[builder(setter(into))]