mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge pull request #1562 from coder2020official/newfeatures
Added ability to hide a link in text
This commit is contained in:
commit
e9d1d98f03
@ -36,6 +36,8 @@ async def start_message(message):
|
||||
formatting.hunderline(message.from_user.first_name),
|
||||
formatting.hstrikethrough(message.from_user.first_name),
|
||||
formatting.hcode(message.from_user.first_name),
|
||||
# hide_link is only for html
|
||||
formatting.hide_link('https://telegra.ph/file/c158e3a6e2a26a160b253.jpg'),
|
||||
separator=" "
|
||||
),
|
||||
parse_mode='HTML'
|
||||
|
@ -36,6 +36,8 @@ def start_message(message):
|
||||
formatting.hunderline(message.from_user.first_name),
|
||||
formatting.hstrikethrough(message.from_user.first_name),
|
||||
formatting.hcode(message.from_user.first_name),
|
||||
# hide_link is only for html
|
||||
formatting.hide_link('https://telegra.ph/file/c158e3a6e2a26a160b253.jpg'),
|
||||
separator=" "
|
||||
),
|
||||
parse_mode='HTML'
|
||||
|
@ -199,3 +199,13 @@ def hpre(content: str, escape: bool=True, language: str="") -> str:
|
||||
:param escape: True if you need to escape special characters.
|
||||
"""
|
||||
return '<pre><code class="{}">{}</code></pre>'.format(language, escape_html(content) if escape else content)
|
||||
|
||||
|
||||
def hide_link(url: str) -> str:
|
||||
"""
|
||||
Hide url of an image.
|
||||
|
||||
:param url:
|
||||
:return: str
|
||||
"""
|
||||
return f'<a href="{url}">⁠</a>'
|
Loading…
Reference in New Issue
Block a user