telegram.ext.Defaults

class telegram.ext.Defaults(parse_mode=None, disable_notification=None, disable_web_page_preview=None, quote=None, tzinfo=<UTC>, block=True, allow_sending_without_reply=None, protect_content=None)[source]

Bases: object

Convenience Class to gather all parameters with a (user defined) default value

Changed in version 20.0: Removed the argument and attribute timeout. Specify default timeout behavior for the networking backend directly via telegram.ext.ApplicationBuilder instead.

Parameters
  • parse_mode (str, optional) – Send MARKDOWN or HTML, if you want Telegram apps to show bold, italic, fixed-width text or URLs in your bot’s message.

  • disable_notification (bool, optional) – Sends the message silently. Users will receive a notification with no sound.

  • disable_web_page_preview (bool, optional) – Disables link previews for links in this message.

  • allow_sending_without_reply (bool, optional) – Pass True, if the message should be sent even if the specified replied-to message is not found.

  • quote (bool, optional) – If set to True, the reply is sent as an actual reply to the message. If reply_to_message_id is passed, this parameter will be ignored. Default: True in group chats and False in private chats.

  • tzinfo (tzinfo, optional) – A timezone to be used for all date(time) inputs appearing throughout PTB, i.e. if a timezone naive date(time) object is passed somewhere, it will be assumed to be in tzinfo. Must be a timezone provided by the pytz module. Defaults to UTC.

  • block (bool, optional) – Default setting for the BaseHandler.block parameter of handlers and error handlers registered through Application.add_handler() and Application.add_error_handler(). Defaults to True.

  • protect_content (bool, optional) –

    Protects the contents of the sent message from forwarding and saving.

    New in version 20.0.

property allow_sending_without_reply[source]

Optional. Pass True, if the message should be sent even if the specified replied-to message is not found.

Type

bool

property block[source]

Optional. Default setting for the BaseHandler.block parameter of handlers and error handlers registered through Application.add_handler() and Application.add_error_handler().

Type

bool

property disable_notification[source]

Optional. Sends the message silently. Users will receive a notification with no sound.

Type

bool

property disable_web_page_preview[source]

Optional. Disables link previews for links in this message.

Type

bool

property explanation_parse_mode[source]

Optional. Alias for parse_mode, used for the corresponding parameter of telegram.Bot.send_poll().

Type

str

property parse_mode[source]

Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or URLs in your bot’s message.

Type

str

property protect_content[source]

Optional. Protects the contents of the sent message from forwarding and saving.

New in version 20.0.

Type

bool

property quote[source]

Optional. If set to True, the reply is sent as an actual reply to the message. If reply_to_message_id is passed, this parameter will be ignored. Default: True in group chats and False in private chats.

Type

bool

property tzinfo[source]

A timezone to be used for all date(time) objects appearing throughout PTB.

Type

tzinfo