mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-20 13:59:00 +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 chat_photo::*;
|
||||||
pub use chosen_inline_result::*;
|
pub use chosen_inline_result::*;
|
||||||
pub use contact::*;
|
pub use contact::*;
|
||||||
|
pub use dice::*;
|
||||||
pub use document::*;
|
pub use document::*;
|
||||||
pub use encrypted_credentials::*;
|
pub use encrypted_credentials::*;
|
||||||
pub use encrypted_passport_element::*;
|
pub use encrypted_passport_element::*;
|
||||||
|
@ -103,6 +104,7 @@ mod chat_permissions;
|
||||||
mod chat_photo;
|
mod chat_photo;
|
||||||
mod chosen_inline_result;
|
mod chosen_inline_result;
|
||||||
mod contact;
|
mod contact;
|
||||||
|
mod dice;
|
||||||
mod document;
|
mod document;
|
||||||
mod file;
|
mod file;
|
||||||
mod force_reply;
|
mod force_reply;
|
||||||
|
|
Loading…
Add table
Reference in a new issue