mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-18 12:48:37 +00:00
Update Chat. Add full_name and mention
This commit is contained in:
parent
80305c326b
commit
b3a13ab6b5
1 changed files with 17 additions and 0 deletions
|
|
@ -43,6 +43,23 @@ class Chat(Deserializable):
|
||||||
async def send_message(self, text):
|
async def send_message(self, text):
|
||||||
self.bot.send_message(self.id, text)
|
self.bot.send_message(self.id, text)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def full_name(self):
|
||||||
|
if self.type == ChatType.PRIVATE:
|
||||||
|
full_name = self.first_name
|
||||||
|
if self.last_name:
|
||||||
|
full_name += ' ' + self.last_name
|
||||||
|
return full_name
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
@property
|
||||||
|
def mention(self):
|
||||||
|
if self.username:
|
||||||
|
return '@' + self.username
|
||||||
|
if self.type == ChatType.PRIVATE:
|
||||||
|
return self.full_name
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class ChatType:
|
class ChatType:
|
||||||
PRIVATE = 'private'
|
PRIVATE = 'private'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue