From 51fc3fb4865dc6cf13b8ddd6401ad2ce442b1ff5 Mon Sep 17 00:00:00 2001 From: Marcel Dechert Date: Sun, 13 Dec 2020 22:33:24 +0100 Subject: [PATCH] add some doc --- src/telegram_bot/telegram_bot.py | 11 ++++++----- src/telegram_bot/telegram_bot_test.py | 8 +++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/telegram_bot/telegram_bot.py b/src/telegram_bot/telegram_bot.py index 0d9a291..21ffb6e 100644 --- a/src/telegram_bot/telegram_bot.py +++ b/src/telegram_bot/telegram_bot.py @@ -6,12 +6,13 @@ TELEGRAM_TOKEN_ID = '1456847960:AAHF6ZVfPrPedN07-Z0FlbtFzuUgpQM3iO4' # token-id TELEGRAM_CHAT_ID = '291512617' # chat-id # ---------------- -# using https://github.com/gvalvano/telegram-notification -def send_notifaction(timestamp): - # - - - - - - - - - - - # Telegram notification: + +def send_notification(timestamp): + """ sends Telegram notification + using https://github.com/gvalvano/telegram-notification + """ formatted_timestamp = timestamp.strftime("%d.%m.%Y, %H:%M:%S") - msg = "Es hat geklingelt \nTimestamp: {}".format(formatted_timestamp) + msg = "Es hat geklingelt! \nTimestamp: {}".format(formatted_timestamp) telegram_notifier.basic_notifier(logger_name='training_notifier', token_id=TELEGRAM_TOKEN_ID, chat_id=TELEGRAM_CHAT_ID, diff --git a/src/telegram_bot/telegram_bot_test.py b/src/telegram_bot/telegram_bot_test.py index 3e28e3d..1d76998 100644 --- a/src/telegram_bot/telegram_bot_test.py +++ b/src/telegram_bot/telegram_bot_test.py @@ -4,11 +4,13 @@ import unittest import telegram_bot import datetime -class TestGetDataFromRKI(unittest.TestCase): - def test_send_notifaction(self): +class SendTestMessageToSwaghausenBot(unittest.TestCase): + + def test_send_notifaction(self): timestamp = datetime.datetime.now() - telegram_bot.send_notifaction(timestamp) + telegram_bot.send_notification(timestamp) + if __name__ == '__main__': unittest.main()