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.

The official docs.

Fields§

§user: User

Information about the user.

§kind: ChatMemberKind

The member’s status in the chat.

Methods from Deref<Target = ChatMemberKind>§

source

pub fn status(&self) -> ChatMemberStatus

Returns chat member status.

source

pub fn is_owner(&self) -> bool

Returns true if the user is the owner of the given chat.

source

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.

source

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.

source

pub fn is_restricted(&self) -> bool

Returns true if the user is restricted in the given chat.

source

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.

source

pub fn is_banned(&self) -> bool

Returns true if the user is banned in the given chat.

source

pub fn is_kicked(&self) -> bool

👎Deprecated: use is_banned instead

Returns true if the user is kicked from the given chat.

source

pub fn is_creator(&self) -> bool

👎Deprecated: use is_owner instead

Returns true if the user is the creator (owner) of the given chat.

source

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.

source

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

pub fn custom_title(&self) -> Option<&str>

source

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.

source

pub fn until_date(&self) -> Option<UntilDate>

source

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.

source

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. Returns false otherwise.
source

pub 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

Returns true if the user can change the chat title, photo and other settings.

I.e. returns true if the user

source

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. Returns false otherwise.
source

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. Returns false otherwise.
source

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. Returns false otherwise.
source

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. Returns false otherwise.
source

pub fn can_manage_voice_chats(&self) -> bool

👎Deprecated since 0.6.0: renamed to can_manage_video_chats
source

pub 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

Returns true if the user can can invite new users to the chat.

I.e. returns true if the user

source

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. Returns false otherwise.
source

pub 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

Returns true if the user can pin messages, supergroups only.

I.e. returns true if the user

source

pub 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

Returns true if the user is allowed to manage topics.

I.e. returns true if the user

source

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. Returns false otherwise.
source

pub 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

Returns 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 Returns true otherwise.
source

pub 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

Returns 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 Returns true otherwise.
source

pub 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

Returns 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 Returns true otherwise.
source

pub 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

Returns 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 Returns true otherwise.
source

pub 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

Returns 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 Returns true otherwise.

Trait Implementations§

source§

impl Clone for ChatMember

source§

fn clone(&self) -> ChatMember

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ChatMember

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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();
§

type Target = ChatMemberKind

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'de> Deserialize<'de> for ChatMember

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Hash for ChatMember

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<ChatMember> for ChatMember

source§

fn eq(&self, other: &ChatMember) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for ChatMember

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for ChatMember

source§

impl StructuralEq for ChatMember

source§

impl StructuralPartialEq for ChatMember

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Erasable for T

§

unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>

Unerase this erased pointer. Read more
§

const ACK_1_1_0: bool = true

Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
§

fn erase(this: NonNull<Self>) -> NonNull<Erased>

Turn this erasable pointer into an erased pointer. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,