Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix telegram coroutine not awaited #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 3 additions & 5 deletions ntfy/backends/telegram.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
from os import makedirs, path

from appdirs import user_config_dir

from telegram_send import configure, send
import asyncio

config_dir = user_config_dir('ntfy', 'dschep')
config_file = path.join(config_dir, 'telegram.ini')


def notify(title, message, retcode=None):
"""Sends message over Telegram using telegram-send, title is ignored."""
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)
asyncio.run(configure(config_file))
asyncio.run(send(messages=[message], conf=config_file))