-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new types. Change old types and methods
- Loading branch information
Showing
24 changed files
with
1,236 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use super::{BackgroundFillFreeformGradient, BackgroundFillGradient, BackgroundFillSolid}; | ||
|
||
use serde::Deserialize; | ||
|
||
/// This object describes the way a background is filled based on the selected colors. Currently, it can be one of | ||
/// - [`BackgroundFillSolid`] | ||
/// - [`BackgroundFillGradient`] | ||
/// - [`BackgroundFillFreeformGradient`] | ||
/// # Documentation | ||
/// <https://core.telegram.org/bots/api#backgroundfill> | ||
#[derive(Debug, Clone, Hash, PartialEq, Eq, Deserialize)] | ||
#[serde(tag = "type", rename_all = "snake_case")] | ||
pub enum BackgroundFill { | ||
Solid(BackgroundFillSolid), | ||
Gradient(BackgroundFillGradient), | ||
FreeformGradient(BackgroundFillFreeformGradient), | ||
} | ||
|
||
impl From<BackgroundFillSolid> for BackgroundFill { | ||
fn from(fill: BackgroundFillSolid) -> Self { | ||
Self::Solid(fill) | ||
} | ||
} | ||
|
||
impl From<BackgroundFillGradient> for BackgroundFill { | ||
fn from(fill: BackgroundFillGradient) -> Self { | ||
Self::Gradient(fill) | ||
} | ||
} | ||
|
||
impl From<BackgroundFillFreeformGradient> for BackgroundFill { | ||
fn from(fill: BackgroundFillFreeformGradient) -> Self { | ||
Self::FreeformGradient(fill) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use serde::Deserialize; | ||
|
||
/// The background is a freeform gradient that rotates after every message in the chat | ||
/// # Documentation | ||
/// <https://core.telegram.org/bots/api#backgroundfillfreeformgradient> | ||
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Deserialize)] | ||
pub struct BackgroundFillFreeformGradient { | ||
/// A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format | ||
pub colors: Box<[u32]>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::Deserialize; | ||
|
||
/// The background is a gradient fill | ||
/// # Documentation | ||
/// <https://core.telegram.org/bots/api#backgroundfillgradient> | ||
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Deserialize)] | ||
pub struct BackgroundFillGradient { | ||
/// Top color of the gradient in the RGB24 format | ||
pub top_color: u32, | ||
/// Bottom color of the gradient in the RGB24 format | ||
pub bottom_color: u32, | ||
/// Clockwise rotation angle of the background fill in degrees; 0-359 | ||
pub rotation_angle: i32, | ||
} |
Oops, something went wrong.