use serde::{Deserialize, Serialize};
use crate::{Request, API};
use super::message::Message;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Sticker {
pub file_id: String,
pub width: i64,
pub height: i64,
pub is_animated: bool,
pub emoji: Option<String>,
pub set_name: Option<String>,
pub file_size: Option<i64>,
}
#[derive(Debug, Serialize, Clone)]
pub struct SendStickerRequest {
pub chat_id: i64,
pub sticker: String,
pub disable_notification: Option<bool>,
pub reply_to_message_id: Option<i64>,
}
impl Request for SendStickerRequest {}
impl SendStickerRequest {
pub fn new(chat_id: i64, sticker: String) -> Self {
Self {
chat_id,
sticker,
disable_notification: None,
reply_to_message_id: None,
}
}
pub fn with_disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
pub fn with_reply_to_message_id(mut self, reply_to_message_id: i64) -> Self {
self.reply_to_message_id = Some(reply_to_message_id);
self
}
}
impl API {
pub async fn send_sticker(&self, req: &SendStickerRequest) -> anyhow::Result<Message> {
self.client.post("sendSticker", req).await
}
}