Struct tg_flows::Chat

source ·
pub struct Chat {
    pub id: ChatId,
    pub kind: ChatKind,
    pub photo: Option<ChatPhoto>,
    pub pinned_message: Option<Box<Message>>,
    pub message_auto_delete_time: Option<u32>,
    pub has_hidden_members: bool,
    pub has_aggressive_anti_spam_enabled: bool,
}
Expand description

This object represents a chat.

The official docs.

Fields§

§id: ChatId

A unique identifier for this chat.

§kind: ChatKind§photo: Option<ChatPhoto>

A chat photo. Returned only in GetChat.

§pinned_message: Option<Box<Message>>

The most recent pinned message (by sending date). Returned only in GetChat.

§message_auto_delete_time: Option<u32>

The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in GetChat.

§has_hidden_members: bool

true, if non-administrators can only get the list of bots and administrators in the chat. Returned only in GetChat.

§has_aggressive_anti_spam_enabled: bool

true, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in GetChat.

Implementations§

source§

impl Chat

source

pub fn is_private(&self) -> bool

source

pub fn is_group(&self) -> bool

source

pub fn is_supergroup(&self) -> bool

source

pub fn is_channel(&self) -> bool

source

pub fn is_chat(&self) -> bool

source§

impl Chat

Getters

source

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

A title, for supergroups, channels and group chats.

source

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

A username, for private chats, supergroups and channels if available.

source

pub fn linked_chat_id(&self) -> Option<i64>

Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa. Returned only in GetChat.

source

pub fn permissions(&self) -> Option<ChatPermissions>

A default chat member permissions, for groups and supergroups. Returned only from GetChat.

source

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

For supergroups, name of group sticker set. Returned only from GetChat.

source

pub fn can_set_sticker_set(&self) -> Option<bool>

true, if the bot can change the group sticker set. Returned only from GetChat.

source

pub fn slow_mode_delay(&self) -> Option<u32>

The minimum allowed delay between consecutive messages sent by each unpriviledged user. Returned only from GetChat.

source

pub fn location(&self) -> Option<&ChatLocation>

The location to which the supergroup is connected. Returned only in GetChat.

source

pub fn join_to_send_messages(&self) -> Option<True>

True, if users need to join the supergroup before they can send messages. Returned only in GetChat.

source

pub fn join_by_request(&self) -> Option<True>

True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in GetChat.

source

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

A description, for groups, supergroups and channel chats. Returned only in GetChat.

A chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using ExportChatInviteLink. Returned only in GetChat.

source

pub fn has_protected_content(&self) -> Option<True>

True, if messages from the chat can’t be forwarded to other chats. Returned only in GetChat.

source

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

A first name of the other party in a private chat.

source

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

A last name of the other party in a private chat.

source

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

Bio of the other party in a private chat. Returned only in GetChat.

source

pub fn has_private_forwards(&self) -> Option<True>

True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in GetChat.

source

pub fn mentioned_users(&self) -> impl Iterator<Item = &User>

Returns all users that are “contained” in this Chat structure.

This might be useful to track information about users.

Note that this function can return duplicate users.

Trait Implementations§

source§

impl Clone for Chat

source§

fn clone(&self) -> Chat

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 Chat

source§

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

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

impl<'de> Deserialize<'de> for Chat

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 PartialEq<Chat> for Chat

source§

fn eq(&self, other: &Chat) -> 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 Chat

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 StructuralPartialEq for Chat

Auto Trait Implementations§

§

impl RefUnwindSafe for Chat

§

impl Send for Chat

§

impl Sync for Chat

§

impl Unpin for Chat

§

impl UnwindSafe for Chat

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>,