mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge remote-tracking branch 'origin/dev-1.x' into dev-1.x
This commit is contained in:
commit
34c5ecd904
8 changed files with 21 additions and 22 deletions
|
|
@ -18,8 +18,8 @@ class Audio(base.TelegramObject, mixins.Downloadable):
|
|||
|
||||
def __hash__(self):
|
||||
return hash(self.file_id) + \
|
||||
self.duration + \
|
||||
hash(self.performer) + \
|
||||
hash(self.title) + \
|
||||
hash(self.mime_type) + \
|
||||
self.file_size
|
||||
self.duration + \
|
||||
hash(self.performer) + \
|
||||
hash(self.title) + \
|
||||
hash(self.mime_type) + \
|
||||
self.file_size
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Chat(base.TelegramObject):
|
|||
@property
|
||||
def mention(self):
|
||||
"""
|
||||
Get mention if dialog have username or full name if this is Private dialog otherwise None
|
||||
Get mention if a Chat has a username, or get full name if this is a Private Chat, otherwise None is returned
|
||||
"""
|
||||
if self.username:
|
||||
return '@' + self.username
|
||||
|
|
@ -51,7 +51,7 @@ class Chat(base.TelegramObject):
|
|||
@property
|
||||
def user_url(self):
|
||||
if self.type != ChatType.PRIVATE:
|
||||
raise TypeError('This property available only in private chats.')
|
||||
raise TypeError('`user_url` property is only available in private chats!')
|
||||
|
||||
return f"tg://user?id={self.id}"
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ class BaseField(metaclass=abc.ABCMeta):
|
|||
|
||||
:param base: class for child element
|
||||
:param default: default value
|
||||
:param alias: alias name (for e.g. field named 'from' must be has name 'from_user'
|
||||
('from' is builtin Python keyword)
|
||||
:param alias: alias name (for e.g. field 'from' has to be named 'from_user'
|
||||
as 'from' is a builtin Python keyword
|
||||
"""
|
||||
self.base_object = base
|
||||
self.default = default
|
||||
|
|
@ -34,7 +34,7 @@ class BaseField(metaclass=abc.ABCMeta):
|
|||
|
||||
def get_value(self, instance):
|
||||
"""
|
||||
Get value for current object instance
|
||||
Get value for the current object instance
|
||||
|
||||
:param instance:
|
||||
:return:
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ class MessageEntity(base.TelegramObject):
|
|||
|
||||
def _apply(self, text, func):
|
||||
return text[:self.offset] + \
|
||||
func(text[self.offset:self.offset + self.length]) + \
|
||||
text[self.offset + self.length:]
|
||||
func(text[self.offset:self.offset + self.length]) + \
|
||||
text[self.offset + self.length:]
|
||||
|
||||
def apply_md(self, text):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class ReplyKeyboardMarkup(base.TelegramObject):
|
|||
|
||||
:param button:
|
||||
"""
|
||||
if self.keyboard and len(self.keyboard[-1] < self.row_width):
|
||||
if self.keyboard and len(self.keyboard[-1]) < self.row_width:
|
||||
self.keyboard[-1].append(button)
|
||||
else:
|
||||
self.add(button)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue