1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use crate::client::Bot;
use serde::Serialize;
/// Use this method to remove a reaction from a message in a group or a supergroup chat. The bot must have the '`can_delete_messages`' administrator right in the chat. Returns `true` on success.
/// # Documentation
/// <https://core.telegram.org/bots/api#deletemessagereaction>
/// # Returns
/// - `bool`
#[derive(Clone, Debug, Serialize)]
pub struct DeleteMessageReaction {
/// Unique identifier for the target chat or username of the target supergroup (in the format @username)
pub chat_id: crate::types::ChatIdKind,
/// Identifier of the target message
pub message_id: i64,
/// Identifier of the user whose reaction will be removed, if the reaction was added by a user
#[serde(skip_serializing_if = "Option::is_none")]
pub user_id: Option<i64>,
/// Identifier of the chat whose reaction will be removed, if the reaction was added by a chat
#[serde(skip_serializing_if = "Option::is_none")]
pub actor_chat_id: Option<i64>,
}
impl DeleteMessageReaction {
/// Creates a new `DeleteMessageReaction`.
///
/// # Arguments
/// * `chat_id` - Unique identifier for the target chat or username of the target supergroup (in the format @username)
/// * `message_id` - Identifier of the target message
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<T0: Into<crate::types::ChatIdKind>, T1: Into<i64>>(
chat_id: T0,
message_id: T1,
) -> Self {
Self {
chat_id: chat_id.into(),
message_id: message_id.into(),
user_id: None,
actor_chat_id: None,
}
}
/// Unique identifier for the target chat or username of the target supergroup (in the format @username)
#[must_use]
pub fn chat_id<T: Into<crate::types::ChatIdKind>>(mut self, val: T) -> Self {
self.chat_id = val.into();
self
}
/// Identifier of the target message
#[must_use]
pub fn message_id<T: Into<i64>>(mut self, val: T) -> Self {
self.message_id = val.into();
self
}
/// Identifier of the user whose reaction will be removed, if the reaction was added by a user
#[must_use]
pub fn user_id<T: Into<i64>>(mut self, val: T) -> Self {
self.user_id = Some(val.into());
self
}
/// Identifier of the user whose reaction will be removed, if the reaction was added by a user
#[must_use]
pub fn user_id_option<T: Into<i64>>(mut self, val: Option<T>) -> Self {
self.user_id = val.map(Into::into);
self
}
/// Identifier of the chat whose reaction will be removed, if the reaction was added by a chat
#[must_use]
pub fn actor_chat_id<T: Into<i64>>(mut self, val: T) -> Self {
self.actor_chat_id = Some(val.into());
self
}
/// Identifier of the chat whose reaction will be removed, if the reaction was added by a chat
#[must_use]
pub fn actor_chat_id_option<T: Into<i64>>(mut self, val: Option<T>) -> Self {
self.actor_chat_id = val.map(Into::into);
self
}
}
impl super::TelegramMethod for DeleteMessageReaction {
type Method = Self;
type Return = bool;
fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
super::Request::new("deleteMessageReaction", self, None)
}
}