Allow plain text messages in telegram_bot (#110051)
* Add new plain_text parser Passing None in the parse_mode kwargs on the various bot methods actually means that no parser is used. * Add new plain text parser option to services.yaml --------- Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
d8aa1cd8b5
commit
cc9eab4c78
2 changed files with 8 additions and 0 deletions
|
@ -122,6 +122,7 @@ EVENT_TELEGRAM_SENT = "telegram_sent"
|
|||
PARSER_HTML = "html"
|
||||
PARSER_MD = "markdown"
|
||||
PARSER_MD2 = "markdownv2"
|
||||
PARSER_PLAIN_TEXT = "plain_text"
|
||||
|
||||
DEFAULT_TRUSTED_NETWORKS = [ip_network("149.154.160.0/20"), ip_network("91.108.4.0/22")]
|
||||
|
||||
|
@ -524,6 +525,7 @@ class TelegramNotificationService:
|
|||
PARSER_HTML: ParseMode.HTML,
|
||||
PARSER_MD: ParseMode.MARKDOWN,
|
||||
PARSER_MD2: ParseMode.MARKDOWN_V2,
|
||||
PARSER_PLAIN_TEXT: None,
|
||||
}
|
||||
self._parse_mode = self._parsers.get(parser)
|
||||
self.bot = bot
|
||||
|
|
|
@ -22,6 +22,7 @@ send_message:
|
|||
- "html"
|
||||
- "markdown"
|
||||
- "markdownv2"
|
||||
- "plain_text"
|
||||
disable_notification:
|
||||
selector:
|
||||
boolean:
|
||||
|
@ -94,6 +95,7 @@ send_photo:
|
|||
- "html"
|
||||
- "markdown"
|
||||
- "markdownv2"
|
||||
- "plain_text"
|
||||
disable_notification:
|
||||
selector:
|
||||
boolean:
|
||||
|
@ -229,6 +231,7 @@ send_animation:
|
|||
- "html"
|
||||
- "markdown"
|
||||
- "markdownv2"
|
||||
- "plain_text"
|
||||
disable_notification:
|
||||
selector:
|
||||
boolean:
|
||||
|
@ -300,6 +303,7 @@ send_video:
|
|||
- "html"
|
||||
- "markdown"
|
||||
- "markdownv2"
|
||||
- "plain_text"
|
||||
disable_notification:
|
||||
selector:
|
||||
boolean:
|
||||
|
@ -435,6 +439,7 @@ send_document:
|
|||
- "html"
|
||||
- "markdown"
|
||||
- "markdownv2"
|
||||
- "plain_text"
|
||||
disable_notification:
|
||||
selector:
|
||||
boolean:
|
||||
|
@ -587,6 +592,7 @@ edit_message:
|
|||
- "html"
|
||||
- "markdown"
|
||||
- "markdownv2"
|
||||
- "plain_text"
|
||||
disable_web_page_preview:
|
||||
selector:
|
||||
boolean:
|
||||
|
|
Loading…
Add table
Reference in a new issue