Struct tg_flows::ChatMember
source · pub struct ChatMember {
pub user: User,
pub kind: ChatMemberKind,
}
Expand description
This object contains information about one member of the chat.
Fields§
§user: User
Information about the user.
kind: ChatMemberKind
The member’s status in the chat.
Methods from Deref<Target = ChatMemberKind>§
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.
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.
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.
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_chat
privilege. Returnsfalse
otherwise.
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_info
privilege. - is restricted, but does have
Restricted::can_change_info
privilege Returnsfalse
otherwise.
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_messages
privilege. Returnsfalse
otherwise.
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_messages
privilege. Returnsfalse
otherwise.
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_messages
privilege. Returnsfalse
otherwise.
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_chats
privilege. Returnsfalse
otherwise.
pub fn can_manage_voice_chats(&self) -> bool
can_manage_video_chats
sourcepub 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_users
privilege. - is restricted, but does have
Restricted::can_invite_users
privilege Returnsfalse
otherwise.
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_members
privilege. Returnsfalse
otherwise.
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_messages
privilege. - is restricted, but does have
Restricted::can_pin_messages
privilege Returnsfalse
otherwise.
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_topics
privilege. - is restricted, but does have
Restricted::can_manage_topics
privilege Returnsfalse
otherwise.
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_members
privilege. Returnsfalse
otherwise.
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_messages
right Returnstrue
otherwise.
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_messages
right Returnstrue
otherwise.
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_messages
right Returnstrue
otherwise.
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_messages
right Returnstrue
otherwise.
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_polls
right Returnstrue
otherwise.
Trait Implementations§
source§impl Clone for ChatMember
impl Clone for ChatMember
source§fn clone(&self) -> ChatMember
fn clone(&self) -> ChatMember
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ChatMember
impl Debug for ChatMember
source§impl Deref for ChatMember
impl Deref for ChatMember
This allows calling ChatMemberKind
’s methods directly on ChatMember
.
use teloxide_core::types::ChatMember;
let member: ChatMember = todo!();
let _ = member.status();
let _ = member.kind.status();
source§impl<'de> Deserialize<'de> for ChatMember
impl<'de> Deserialize<'de> for ChatMember
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 ChatMember
impl Hash for ChatMember
source§impl PartialEq<ChatMember> for ChatMember
impl PartialEq<ChatMember> for ChatMember
source§fn eq(&self, other: &ChatMember) -> bool
fn eq(&self, other: &ChatMember) -> bool
self
and other
values to be equal, and is used
by ==
.