Multiple small changes/fixed typos to docs/error messages (#623)

This commit is contained in:
Joscha Götzer
2018-03-01 13:21:28 +01:00
committed by Lonami
parent 3184641549
commit 835ff51e25
10 changed files with 71 additions and 35 deletions

View File

@@ -35,8 +35,10 @@ VALID_USERNAME_RE = re.compile(r'^[a-zA-Z][\w\d]{3,30}[a-zA-Z\d]$')
def get_display_name(entity):
"""Gets the input peer for the given "entity" (user, chat or channel)
Returns None if it was not found"""
"""
Gets the display name for the given entity, if it's an ``User``,
``Chat`` or ``Channel``. Returns an empty string otherwise.
"""
if isinstance(entity, User):
if entity.last_name and entity.first_name:
return '{} {}'.format(entity.first_name, entity.last_name)