mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-08 19:33:53 +01:00
Add setters to Me
This commit is contained in:
parent
c2fe72fc47
commit
8cd9d582aa
2 changed files with 35 additions and 1 deletions
|
@ -21,3 +21,37 @@ pub struct Me {
|
|||
/// `true`, if the bot supports inline queries.
|
||||
pub supports_inline_queries: bool,
|
||||
}
|
||||
|
||||
impl Me {
|
||||
pub fn new(
|
||||
user: User,
|
||||
can_join_groups: bool,
|
||||
can_read_all_group_messages: bool,
|
||||
supports_inline_queries: bool,
|
||||
) -> Self {
|
||||
Self { user, can_join_groups, can_read_all_group_messages, supports_inline_queries }
|
||||
}
|
||||
|
||||
pub fn user(mut self, val: User) -> Self {
|
||||
self.user = val;
|
||||
self
|
||||
}
|
||||
|
||||
#[warn(clippy::wrong_self_convention)]
|
||||
pub fn can_join_groups<S>(mut self, val: bool) -> Self {
|
||||
self.can_join_groups = val;
|
||||
self
|
||||
}
|
||||
|
||||
#[warn(clippy::wrong_self_convention)]
|
||||
pub fn can_read_all_group_messages<S>(mut self, val: bool) -> Self {
|
||||
self.can_read_all_group_messages = val;
|
||||
self
|
||||
}
|
||||
|
||||
#[warn(clippy::wrong_self_convention)]
|
||||
pub fn supports_inline_queries<S>(mut self, val: bool) -> Self {
|
||||
self.supports_inline_queries = val;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ impl User {
|
|||
self
|
||||
}
|
||||
|
||||
#[warn(clippy::wrong_self_convention)]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_bot<S>(mut self, val: bool) -> Self {
|
||||
self.is_bot = val;
|
||||
self
|
||||
|
|
Loading…
Reference in a new issue