2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 12:57:52 +00:00

Add ParseMode module

This commit is contained in:
Dan 2018-01-23 15:34:36 +01:00
parent e7cbff8087
commit 84ae464b52
4 changed files with 55 additions and 16 deletions

View File

@ -23,3 +23,4 @@ __version__ = "0.4.2"
from .api.errors import Error
from .client import ChatAction
from .client import Client
from .client import ParseMode

View File

@ -18,3 +18,4 @@
from .chat_action import ChatAction
from .client import Client
from .parse_mode import ParseMode

View File

@ -488,8 +488,9 @@ class Client:
Text of the message to be sent.
parse_mode (:obj:`str`):
Use "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your message. Defaults to "Markdown".
Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps
to show bold, italic, fixed-width text or inline URLs in your message.
Defaults to MARKDOWN.
disable_web_page_preview (:obj:`bool`, optional):
Disables link previews for links in this message.
@ -585,8 +586,9 @@ class Client:
Photo caption, 0-200 characters.
parse_mode (:obj:`str`):
Use "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your caption. Defaults to "Markdown".
Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps
to show bold, italic, fixed-width text or inline URLs in your caption.
Defaults to MARKDOWN.
ttl_seconds (:obj:`int`, optional):
Self-Destruct Timer.
@ -657,8 +659,9 @@ class Client:
Audio caption, 0-200 characters.
parse_mode (:obj:`str`):
Use "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your caption. Defaults to "Markdown".
Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps
to show bold, italic, fixed-width text or inline URLs in your caption.
Defaults to MARKDOWN.
duration (:obj:`int`, optional):
Duration of the audio in seconds.
@ -736,8 +739,9 @@ class Client:
Document caption, 0-200 characters.
parse_mode (:obj:`str`):
Use "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your caption. Defaults to "Markdown".
Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps
to show bold, italic, fixed-width text or inline URLs in your caption.
Defaults to MARKDOWN.
disable_notification (:obj:`bool`, optional):
Sends the message silently.
@ -804,8 +808,9 @@ class Client:
Video caption, 0-200 characters.
parse_mode (:obj:`str`):
Use "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your caption. Defaults to "Markdown".
Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps
to show bold, italic, fixed-width text or inline URLs in your caption.
Defaults to MARKDOWN.
duration (:obj:`int`, optional):
Duration of sent video in seconds.
@ -883,8 +888,9 @@ class Client:
Voice message caption, 0-200 characters.
parse_mode (:obj:`str`):
Use "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your caption. Defaults to "Markdown".
Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps
to show bold, italic, fixed-width text or inline URLs in your caption.
Defaults to MARKDOWN.
duration (:obj:`int`, optional):
Duration of the voice message in seconds.
@ -1247,8 +1253,9 @@ class Client:
New text of the message.
parse_mode (:obj:`str`):
Use "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your message. Defaults to "Markdown".
Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps
to show bold, italic, fixed-width text or inline URLs in your message.
Defaults to MARKDOWN.
disable_web_page_preview (:obj:`bool`, optional):
Disables link previews for links in this message.
@ -1287,8 +1294,9 @@ class Client:
New caption of the message.
parse_mode (:obj:`str`):
Use "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your caption. Defaults to "Markdown".
Use :obj:`pyrogram.ParseMode.MARKDOWN` or :obj:`pyrogram.ParseMode.HTML` if you want Telegram apps
to show bold, italic, fixed-width text or inline URLs in your caption.
Defaults to MARKDOWN.
Raises:
:class:`pyrogram.Error`

View File

@ -0,0 +1,29 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
class ParseMode:
"""This class provides a convenient access to parse modes.
It is intended to be used with any method that accepts the optional argument **parse_mode**
"""
HTML = "html"
"""Set the parse mode to HTML style"""
MARKDOWN = "markdown"
"""Set the parse mode to Markdown style"""