0.0.8-newage
This commit is contained in:
9
tgbot/utils/mention.py
Normal file
9
tgbot/utils/mention.py
Normal 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}'
|
Reference in New Issue
Block a user