Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ntfy/backends/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
config_file = path.join(config_dir, 'telegram.ini')


def notify(title, message, retcode=None):
"""Sends message over Telegram using telegram-send, title is ignored."""
def notify(title, message, parse_mode="text", retcode=None):
"""
Sends message over Telegram using telegram-send, title is ignored.

Optional parameters:
* ``parse_mode`` - How telegram parses the text. Possible options are "text", "markdown" or "html". More details here: https://core.telegram.org/bots/api#formatting-options
"""
if not path.exists(config_file):
if not path.exists(config_dir):
makedirs(config_dir)
print("Follow the instructions to configure the Telegram backend.\n")
configure(config_file)
send(messages=[message], conf=config_file)
send(messages=[message], parse_mode=parse_mode, conf=config_file)