pub enum Peer {
User(User),
Group(Group),
Channel(Channel),
}Expand description
A peer.
Peers represent places where you can share messages with others.
- Private conversations with other people are treated as the peer of the user itself.
- Conversations in a group, whether it’s private or public, are simply known as groups.
- Conversations where only administrators broadcast messages are known as channels.
Variants§
Implementations§
Source§impl Peer
impl Peer
pub fn from_raw(chat: Chat) -> Self
Sourcepub fn id(&self) -> PeerId
pub fn id(&self) -> PeerId
Return the unique identifier for this peer.
Every account will see the same identifier for the same peer.
This identifier will never change. However, small group chats may be migrated to megagroups. If this happens, both the old small group chat and the new megagroup exist as separate chats with different identifiers, but they are linked with a property.
Sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
Return the name of this peer.
For private conversations (users), this is their first name. For groups and channels, this is their title.
The name will be None if the peer is inaccessible or if the account was deleted. It may
also be None if you received it previously.
Sourcepub fn username(&self) -> Option<&str>
pub fn username(&self) -> Option<&str>
Return the public @username of this peer, if any.
The returned username does not contain the “@” prefix.
Outside of the application, people may link to this user with one of Telegram’s URLs, such as https://t.me/username.
Sourcepub fn usernames(&self) -> Vec<&str>
pub fn usernames(&self) -> Vec<&str>
Return collectible usernames of this peer, if any.
The returned usernames do not contain the “@” prefix.
Outside of the application, people may link to this user with one of its username, such as https://t.me/username.