mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
chore: add full_name for Chat
This commit is contained in:
parent
adfc89f125
commit
e3b72bbcab
1 changed files with 15 additions and 0 deletions
|
|
@ -76,6 +76,21 @@ class Chat(TelegramObject):
|
||||||
shift = int(-1 * pow(10, len(short_id) + 2))
|
shift = int(-1 * pow(10, len(short_id) + 2))
|
||||||
return shift - self.id
|
return shift - self.id
|
||||||
|
|
||||||
|
@property
|
||||||
|
def full_name(self) -> str:
|
||||||
|
"""Get full name of the Chat.
|
||||||
|
|
||||||
|
For private chat it is first_name + last_name.
|
||||||
|
For other chat types it is title.
|
||||||
|
"""
|
||||||
|
if self.title is not None:
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
if self.last_name is not None:
|
||||||
|
return f"{self.first_name} {self.last_name}"
|
||||||
|
|
||||||
|
return self.first_name
|
||||||
|
|
||||||
def ban_sender_chat(self, sender_chat_id: int) -> BanChatSenderChat:
|
def ban_sender_chat(self, sender_chat_id: int) -> BanChatSenderChat:
|
||||||
from ..methods import BanChatSenderChat
|
from ..methods import BanChatSenderChat
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue