0.0.8-newage

This commit is contained in:
2023-04-23 19:54:58 +03:00
parent 297445fd50
commit 7b12a491e8
20 changed files with 572 additions and 321 deletions

9
tgbot/utils/mention.py Normal file
View File

@@ -0,0 +1,9 @@
# generates a mention from standard telegram web json 'from' field
# using HTML markup
def mention(user):
identity = f"{user['first_name']} {user.get('last_name', '')}".strip()
uid = user['id']
username = user.get('username', '')
if username:
username = f'(@{username})'
return f'<a href="tg://user?id={uid}"><b>{identity}</b></a>{username}'