pytdbot.utils.text_format
- pytdbot.utils.text_format.bold(text, html=True, escape=True)[source]
Convert the given text to bold format
- Parameters:
text (
str
) – The text to converthtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.code(text, html=True, escape=True)[source]
Convert the given text to code format
- Parameters:
text (
str
) – The text to converthtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.custom_emoji(emoji, custom_emoji_id, html=True)[source]
Convert the given emoji to custom emoji format
- Parameters:
emoji (
str
) – The emoji of the custom emojicustom_emoji_id (
str
) – Identifier of the custom emojihtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.hyperlink(text, url, html=True, escape=True)[source]
Convert the given text to hyperlink format
- Parameters:
text (
str
) – The hyperlink texturl (
str
) – The hyperlink urlhtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.italic(text, html=True, escape=True)[source]
Convert the given text to italic format
- Parameters:
text (
str
) – The text to converthtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.ltr(text)[source]
Add LTR (Left-to-Right) mark to the given text
- Parameters:
text (
str
) – The text to convert- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.mention(text, user_id, html=True, escape=True)[source]
Convert the given text to inline mention format
- Parameters:
text (
str
) – The text of inline mentionuser_id (
str
) – The inline user id to mentionhtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.pre(text, html=True, escape=True)[source]
Convert the given text to pre format
- Parameters:
text (
str
) – The text to converthtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.pre_code(text, language, html=True, escape=True)[source]
Convert the given text to pre-formatted fixed-width code block
- Parameters:
text (
str
) – The text to convertlanguage (
str
) – The name of the programming language written in the given code blockhtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.quote(text, expandable=False, html=True, escape=True)[source]
Convert the given text to quote block
- Parameters:
text (
str
) – The text to convertexpandable (
bool
, optional) – Wether the quote is expandable or not. Default isFalse
html (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.rtl(text)[source]
Add RTL (Right-to-Left) mark to the given text
- Parameters:
text (
str
) – The text to convert- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.spoiler(text, html=True, escape=True)[source]
Convert the given text to spoiler format
- Parameters:
text (
str
) – The text to converthtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.strikethrough(text, html=True, escape=True)[source]
Convert the given text to strikethrough format
- Parameters:
text (
str
) – The text to converthtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str
- pytdbot.utils.text_format.underline(text, html=True, escape=True)[source]
Convert the given text to underline format
- Parameters:
text (
str
) – The text to converthtml (
bool
, optional) – IfTrue
, returns HTML format, ifFalse
returns MarkdownV2. Default isTrue
escape (
bool
, optional) – Whether escape special characters to the given text or not. Default isTrue
- Returns:
The formated text
- Return type:
str