mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Add Dice
This commit is contained in:
parent
54729c6d34
commit
30ee253376
2 changed files with 40 additions and 0 deletions
38
src/types/dice.rs
Normal file
38
src/types/dice.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::requests::SendDiceEmoji;
|
||||
|
||||
/// This object represents an animated emoji that displays a random value.
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[non_exhaustive]
|
||||
pub struct Dice {
|
||||
/// Emoji on which the dice throw animation is based.
|
||||
emoji: SendDiceEmoji,
|
||||
|
||||
/// Value of the dice.
|
||||
///
|
||||
/// 1-6 for [`SendDiceEmoji::Dice`] and [`SendDiceEmoji::Darts`], 1-5 for
|
||||
/// [`SendDiceEmoji::Basketball`].
|
||||
///
|
||||
/// [`SendDiceEmoji::Dice`]: crate::types::SendDiceEmoji::Dice
|
||||
/// [`SendDiceEmoji::Darts`]:crate::types::SendDiceEmoji::Darts
|
||||
/// [`SendDiceEmoji::Basketball`]:crate::types::SendDiceEmoji::Basketball
|
||||
value: i32,
|
||||
}
|
||||
|
||||
impl Dice {
|
||||
pub fn new(emoji: SendDiceEmoji, value: i32) -> Self {
|
||||
Self { emoji, value }
|
||||
}
|
||||
|
||||
pub fn emoji(mut self, val: SendDiceEmoji) -> Self {
|
||||
self.emoji = val;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn value<S>(mut self, val: i32) -> Self {
|
||||
self.value = val;
|
||||
self
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ pub use chat_permissions::*;
|
|||
pub use chat_photo::*;
|
||||
pub use chosen_inline_result::*;
|
||||
pub use contact::*;
|
||||
pub use dice::*;
|
||||
pub use document::*;
|
||||
pub use encrypted_credentials::*;
|
||||
pub use encrypted_passport_element::*;
|
||||
|
@ -103,6 +104,7 @@ mod chat_permissions;
|
|||
mod chat_photo;
|
||||
mod chosen_inline_result;
|
||||
mod contact;
|
||||
mod dice;
|
||||
mod document;
|
||||
mod file;
|
||||
mod force_reply;
|
||||
|
|
Loading…
Reference in a new issue