pub enum ChatMemberKind {
Owner(Owner),
Administrator(Administrator),
Member,
Restricted(Restricted),
Left,
Banned(Banned),
}Variants§
Implementations§
Source§impl ChatMemberKind
Simple methods for checking a user status.
impl ChatMemberKind
Simple methods for checking a user status.
Sourcepub fn status(&self) -> ChatMemberStatus
pub fn status(&self) -> ChatMemberStatus
Returns chat member status.
Sourcepub fn is_administrator(&self) -> bool
pub fn is_administrator(&self) -> bool
Returns true if the user is an administrator of the given chat.
Note: this function doesn’t return true if the user is the
owner of the given chat. See also: is_privileged.
Sourcepub fn is_member(&self) -> bool
pub fn is_member(&self) -> bool
Returns true if the user is a common member of the given chat.
⚠️ Don’t confuse this with is_present. This method merely checks
for ChatMemberKind::Member variant which is not enough to determine
if the user is joinned to the chat. Use is_present for that instead.
Sourcepub fn is_restricted(&self) -> bool
pub fn is_restricted(&self) -> bool
Returns true if the user is restricted in the given chat.
Sourcepub fn is_left(&self) -> bool
pub fn is_left(&self) -> bool
Returns true if the user left the given chat.
⚠️ Don’t confuse this with is_present. This method merely checks
for ChatMemberKind::Left variant which is not enough to determine
if the user is joinned to the chat. Use is_present for that instead.
Sourcepub fn is_kicked(&self) -> bool
👎Deprecated: use is_banned instead
pub fn is_kicked(&self) -> bool
is_banned insteadReturns true if the user is kicked from the given chat.
Sourcepub fn is_creator(&self) -> bool
👎Deprecated: use is_owner instead
pub fn is_creator(&self) -> bool
is_owner insteadReturns true if the user is the creator (owner) of the given chat.
Source§impl ChatMemberKind
Compound methods for checking a user status.
impl ChatMemberKind
Compound methods for checking a user status.
Sourcepub fn is_privileged(&self) -> bool
pub fn is_privileged(&self) -> bool
Returns true if the user is privileged in the given chat. i.e. if the
user is either the owner or an administrator in the given chat.
Sourcepub fn is_present(&self) -> bool
pub fn is_present(&self) -> bool
Returns true if the user is currently present in the chat. i.e. if the
user hasn’t left or been banned. It also returns false if the
user left the chat, but was restricted.
Source§impl ChatMemberKind
impl ChatMemberKind
Sourcepub fn custom_title(&self) -> Option<&str>
pub fn custom_title(&self) -> Option<&str>
Getter for Administrator::custom_title and Owner::custom_title
fields.
Sourcepub fn is_anonymous(&self) -> bool
pub fn is_anonymous(&self) -> bool
Returns true if the user’s presence in the chat is hidden.
I.e. returns true if the user is the owner of the chat or an
administrator in the chat and has the can_manage_chat privilege.
Returns false otherwise.
Sourcepub fn until_date(&self) -> Option<UntilDate>
pub fn until_date(&self) -> Option<UntilDate>
Getter for Restricted::until_date and Banned::until_date fields.
Source§impl ChatMemberKind
Methods for checking admin privileges.
impl ChatMemberKind
Methods for checking admin privileges.
Sourcepub fn can_be_edited(&self) -> bool
pub fn can_be_edited(&self) -> bool
Returns true if the user is an administrator in the given chat and the
bot is allowed to edit administrator privileges of that user.
Sourcepub fn can_manage_chat(&self) -> bool
pub fn can_manage_chat(&self) -> bool
Returns true if the user can access the chat event log, chat
statistics, message statistics in channels, see channel members, see
anonymous administrators in supergroups and ignore slow mode. Implied by
any other administrator privilege.
I.e. returns true if the user
- is the owner of the chat
- is an administrator in the given chat and has
can_manage_chatprivilege. Returnsfalseotherwise.
Sourcepub fn can_change_info(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_change_info field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_change_info(&self) -> bool
can_change_info field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user can change the chat title, photo and other
settings.
I.e. returns true if the user
- is the owner of the chat
- is an administrator in the given chat and has the
Administrator::can_change_infoprivilege. - is restricted, but does have
Restricted::can_change_infoprivilege Returnsfalseotherwise.
Sourcepub fn can_post_messages(&self) -> bool
pub fn can_post_messages(&self) -> bool
Returns true if the user can post in the channel, channels only.
I.e. returns true if the user
- is the owner of the chat (even if the chat is not a channel)
- is an administrator in the given chat and has
can_post_messagesprivilege. Returnsfalseotherwise.
Sourcepub fn can_edit_messages(&self) -> bool
pub fn can_edit_messages(&self) -> bool
Returns true if the user can edit messages of other users and can pin
messages, channels only.
I.e. returns true if the user
- is the owner of the chat (even if the chat is not a channel)
- is an administrator in the given chat and has the
can_edit_messagesprivilege. Returnsfalseotherwise.
Sourcepub fn can_delete_messages(&self) -> bool
pub fn can_delete_messages(&self) -> bool
Returns true if the user can delete messages of other users.
I.e. returns true if the user
- is the owner of the chat
- is an administrator in the given chat and has the
can_delete_messagesprivilege. Returnsfalseotherwise.
Sourcepub fn can_manage_video_chats(&self) -> bool
pub fn can_manage_video_chats(&self) -> bool
Returns true if the user can manage video chats.
I.e. returns true if the user
- is the owner of the chat
- is an administrator in the given chat and has the
can_manage_video_chatsprivilege. Returnsfalseotherwise.
pub fn can_manage_voice_chats(&self) -> bool
can_manage_video_chatsSourcepub fn can_invite_users(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_invite_users field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_invite_users(&self) -> bool
can_invite_users field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user can can invite new users to the chat.
I.e. returns true if the user
- is the owner of the chat
- is an administrator in the given chat and has the
Administrator::can_invite_usersprivilege. - is restricted, but does have
Restricted::can_invite_usersprivilege Returnsfalseotherwise.
Sourcepub fn can_restrict_members(&self) -> bool
pub fn can_restrict_members(&self) -> bool
Returns true if the user can restrict, ban or unban chat members.
I.e. returns true if the user
- is the owner of the chat
- is an administrator in the given chat and has the
can_restrict_membersprivilege. Returnsfalseotherwise.
Sourcepub fn can_pin_messages(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_pin_messages field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_pin_messages(&self) -> bool
can_pin_messages field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user can pin messages, supergroups only.
I.e. returns true if the user
- is the owner of the chat (even if the chat is not a supergroup)
- is an administrator in the given chat and has the
Administrator::can_pin_messagesprivilege. - is restricted, but does have
Restricted::can_pin_messagesprivilege Returnsfalseotherwise.
Sourcepub fn can_manage_topics(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_manage_topics field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_manage_topics(&self) -> bool
can_manage_topics field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user is allowed to manage topics.
I.e. returns true if the user
- is the owner of the chat (even if the chat is not a supergroup)
- is an administrator in the given chat and has the
Administrator::can_manage_topicsprivilege. - is restricted, but does have
Restricted::can_manage_topicsprivilege Returnsfalseotherwise.
Sourcepub fn can_promote_members(&self) -> bool
pub fn can_promote_members(&self) -> bool
Returns true if the user can add new administrators with a subset of
his own privileges or demote administrators that he has promoted,
directly or indirectly (promoted by administrators that were appointed
by the user).
I.e. returns true if the user
- is the owner of the chat (even if the chat is not a channel)
- is an administrator in the given chat and has the
can_promote_membersprivilege. Returnsfalseotherwise.
Source§impl ChatMemberKind
Methods for checking member rights.
impl ChatMemberKind
Methods for checking member rights.
Sourcepub fn can_send_messages(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_send_messages field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_send_messages(&self) -> bool
can_send_messages field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user can send text messages, contacts, locations
and venues.
I.e. returns false if the user
- has left or has been banned in the chat
- is restricted and doesn’t have the
can_send_messagesright Returnstrueotherwise.
Sourcepub fn can_send_media_messages(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_send_media_messages field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_send_media_messages(&self) -> bool
can_send_media_messages field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user is allowed to send audios, documents, photos,
videos, video notes and voice notes.
I.e. returns false if the user
- has left or has been banned in the chat
- is restricted and doesn’t have the
can_send_media_messagesright Returnstrueotherwise.
Sourcepub fn can_send_other_messages(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_send_other_messages field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_send_other_messages(&self) -> bool
can_send_other_messages field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user is allowed to send animations, games,
stickers and use inline bots.
I.e. returns false if the user
- has left or has been banned from the chat
- is restricted and doesn’t have the
can_send_media_messagesright Returnstrueotherwise.
Sourcepub fn can_add_web_page_previews(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_add_web_page_previews field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_add_web_page_previews(&self) -> bool
can_add_web_page_previews field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user is allowed to add web page previews to their
messages.
I.e. returns false if the user
- has left or has been banned from the chat
- is restricted and doesn’t have the
can_send_media_messagesright Returnstrueotherwise.
Sourcepub fn can_send_polls(&self) -> bool
👎Deprecated since 0.9.0: Match manually and use can_send_polls field directly. Details: https://github.com/teloxide/teloxide/issues/781
pub fn can_send_polls(&self) -> bool
can_send_polls field directly. Details: https://github.com/teloxide/teloxide/issues/781Returns true if the user is allowed to send polls.
I.e. returns false if the user
- has left or has been banned from the chat
- is restricted and doesn’t have the
can_send_pollsright Returnstrueotherwise.
Trait Implementations§
Source§impl Clone for ChatMemberKind
impl Clone for ChatMemberKind
Source§fn clone(&self) -> ChatMemberKind
fn clone(&self) -> ChatMemberKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChatMemberKind
impl Debug for ChatMemberKind
Source§impl<'de> Deserialize<'de> for ChatMemberKind
impl<'de> Deserialize<'de> for ChatMemberKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for ChatMemberKind
impl Hash for ChatMemberKind
Source§impl PartialEq for ChatMemberKind
impl PartialEq for ChatMemberKind
Source§impl Serialize for ChatMemberKind
impl Serialize for ChatMemberKind
impl Eq for ChatMemberKind
impl StructuralPartialEq for ChatMemberKind
Auto Trait Implementations§
impl Freeze for ChatMemberKind
impl RefUnwindSafe for ChatMemberKind
impl Send for ChatMemberKind
impl Sync for ChatMemberKind
impl Unpin for ChatMemberKind
impl UnwindSafe for ChatMemberKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Erasable for T
impl<T> Erasable for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more