pytdbot.utils.escape

pytdbot.utils.escape.escape_html(text, quote=True)[source]

Escape HTML characters in the given text

Parameters:
  • text (str) – The text to escape

  • quote (bool, optional) – Whether to escape double quotes. Default is True

Returns:

The escaped text

Return type:

str

pytdbot.utils.escape.escape_markdown(text, version=2)[source]

Escape Markdown characters in the given text

Parameters:
  • text (str) – The text to escape

  • version (int, optional) – The Markdown version to escape. Default is 2

Returns:

The escaped text

Return type:

str

Raises:

ValueError – If the given markdown version is not supported